Using 'Execute shell script on remote host using ssh' option and need sudo rights on remote server to change permissions and remove protected files. How to run session with this rights?
Getting message
sudo: sorry, you must have a tty to run sudo
when trying to run sudo command.
To run sudo
remotely you have 2 options
sudo
commands without a password.Append username ALL=(ALL) NOPASSWD: ALL
the /etc/sudoers
file with sudo visudo
. Alternatively you can modify this line to only allow certain sudo
commands to be run without a password
sudo
password when requsted.To do this run ssh -t username@host command_to_execute
If the remote server accepts the direct login of the root
user you can simply do:
ssh -l root yourserver command_to_execute
Similar syntax is:
ssh root@yourserver command_to_execute
Mind that allowing the login of the root
user via ssh to a remote server isn't always a good solution.
A better solution would be change the owner / permissions to allow a non-root user to modify the protected files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With