We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
How to execute commands that need sudo, like:
sudo
let vec: Vec<u8> = exec.send_command("sudo systemctl stop some.service").unwrap(); println!("{}", String::from_utf8(vec).unwrap());
The text was updated successfully, but these errors were encountered:
Can try like this:
let vec: Vec<u8> = exec.send_command("echo 'password'|sudo -S rm -R /xxx/xxx").unwrap();
Or use the shell channel for interactive operations.
Sorry, something went wrong.
Thanks, yes echo 'password' | sudo -S somecmd works nicely.
echo 'password' | sudo -S somecmd
No branches or pull requests
How to execute commands that need
sudo
, like:The text was updated successfully, but these errors were encountered: