MyTetra Share
Делитесь знаниями!
Use SSH Client With Password On Command Line
Время создания: 14.11.2013 10:10
Раздел: root - Linux - Console
Запись: Yurons/mytetra/master/base/138441305917ew3mt2lt/text.html на raw.github.com

http://www.cyberciti.biz/faq/linux-unix-applesox-ssh-password-on-command-line/

H

ow do I pass an additional command line option to my OpenSSH client for password? I need to pass the both usename and password on the command line as follows:

ssh user@server.nixcraft.net.in myPasswordHere "command1"

How do I pass a password to ssh client under Linux or UNIX operating systems?

You need to use the sshpass command. It is a utility designed for running ssh using the mode referred to as "keyboard-interactive" password authentication, but in non-interactive mode. You can install it as follows:

$ sudo apt-get install sshpass

And pass the password as follows:

$ sshpass -p 'mySSHPasswordHere' ssh username@server.nixcraft.net.in "uptime"

OR

$ sshpass -p 'PASSWORD' ssh -o StrictHostKeyChecking=no username@server.nixcraft.net.in "who"

 
MyTetra Share v.0.59
Яндекс индекс цитирования