-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
possibility to run sudo commands #90
Comments
Hi @solancer You can either use a pty to send the password or you can provide the password in stdin to ssh.exec('sudo', ['ls /'], { stdin: 'mypassword\n' })
|
That worked like a charm, thanks for taking time to develop such an awesome lib. If you ever come down to Bangalore beer's on me mate ;) |
Thanks for the offer, glad you like it :) |
Hi @steelbrain |
@SlavikVostretsov You have to pass ssh.exec('sudo', ['ls /'], { stdin: 'mypassword\n', pty: true }) |
@steelbrain Still got the same error :( |
@SlavikVostretsov In that case, it's an ssh server config issue. Try googling with that error message to see if that helps |
There's a typo, ssh.exec("sudo", ["mv file /home/path/"], { options: { pty: true }, stdin: "mypass\n" } ) |
As of now for version ssh.exec("sudo", ["mv file /home/path/"], { execOptions: { pty: true }, stdin: "mypass\n" } ) |
I have tried this with
The response is: |
Is it possible to run sudo commands? sending in password to the pty?
The text was updated successfully, but these errors were encountered: