LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to add password paramtre to ssh command? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-add-password-paramtre-to-ssh-command-807560/)

ajeetsinghraina 05-13-2010 05:56 AM

How to add password paramtre to ssh command?
 
I dont want to use ssh key authentication.
I have a simple script which I need to ssh to remote machine and all I want is to supply the password on the same ssh commandline?
Is it possible?

TB0ne 05-13-2010 06:35 AM

Quote:

Originally Posted by ajeetsinghraina (Post 3966828)
I dont want to use ssh key authentication.
I have a simple script which I need to ssh to remote machine and all I want is to supply the password on the same ssh commandline?
Is it possible?

No. If you don't want to use key authentication, SSH will prompt you for a password. If you're trying to script something, you can use expect to send the password.

ajeetsinghraina 05-13-2010 06:36 AM

Code:

you can use expect to send the password
Can you elaborate?

EricTRA 05-13-2010 06:52 AM

Hello,

I use sshpass on my Debian servers to send the complete connection and command string from within my scripts. Should be in your repositories, if not have a look at Google.
I use it like this:
Code:

sshpass -p 'password' ssh user@server 'command'
Kind regards,

Eric

TB0ne 05-13-2010 07:06 AM

Quote:

Originally Posted by ajeetsinghraina (Post 3966858)
Code:

you can use expect to send the password
Can you elaborate?

Expect script tutorials can easily be found on Google.

EricTRA...nice one. Never even heard of that particular goodie. I'd always swap keys, or use Perl or expect to knock out something. Probably perl, since (I think), it's a bit more robust.


All times are GMT -5. The time now is 08:07 AM.