fieldrndservices / libssh2-labview

A LabVIEW library for SSH client support via libssh2
Apache License 2.0
22 stars 2 forks source link

Upgrade to root #50

Closed Clio75 closed 2 years ago

Clio75 commented 2 years ago

Hi and thanx for the Lib.

I have not figured how to upgrade for a user to root. after establish the connection. Short description ;) I login to UUT with keys. Then I need to become root. So I have tried to send (su -) and the send a password. But get no reply image

In putty I can do this without any problems. image

I hope you can point me in the right direction :)

volks73 commented 2 years ago

PuTTY creates an interactive terminal/shell with the remote device. This allows you to type in the password and interact with various commands by sending keystrokes to STDIN. The su - command, with this invocation defaults to interactive mode, where it prints a prompt, Password: to the shell/terminal, most likely on STDOUT. PuTTY is continuously reading and writing from STDOUT and to STDIN, respectively.

I would suggest trying to do a read after each write, i.e. between writing su - and password. I think the prompt for the password, Password:, is being included in the password.

Can you try the Read-Execute-Print-Loop with a Raspberry Pi.vi example to execute the elevation command, su -. It provides a more interactive-like implementation. It will work with any remote SSH device. It does not have to be a Raspberry Pi.

Clio75 commented 2 years ago

Hi, Yes you was right. I also needed to add this Write Termminal.vi to get the password : back from the UUT.

So now I was able to preform this SU - with password :)

Thanx

volks73 commented 2 years ago

Great! Glad to hear you were able to find a resolution to the issue/answer to your question. Thank you for reporting back on the success. I am going to close this issue as it appears to be resolved.