Pages

Thursday, August 16, 2012

Password prompt via ssh

Sometimes when working with ssh you want to run a command that require root privileges on the remote host.
For instance when running apt-get install.

The trick is then to add the -t option to ssh so you get to write the remote host password.
Like this:
ssh -t example.com "sudo apt-get install nmap"


Without the -t option you would get the following error:
sudo: no tty present and no askpass program specified



No comments:

Post a Comment