commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
The above is OK if you not worried about security, as per sshpass man pages:
" The -p option should be considered the least secure of all of sshpass's options. All system users can see the password in the command line with a simple "ps" command."
So, instead what I do is use the -e option:
" -e The password is taken from the environment variable "SSHPASS"."
You need to install "sshpass" for this to work.
apt-get install sshpass
Example: remote install an application(wine).
sshpass -p 'mypssword' ssh -t email@example.com "echo 'mypassword' | sudo -S apt-get install wine"
Tested on Ubuntu.