Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I can not use public key method. I also don't want to use expect script. I searched this site for solution but everybody is talking about these solutions.

Is there any other way like command line parameter to ssh command (e.g. --password='asdf') or input redirection ("<") ?

share|improve this question
3  
I think SSH client has been engineered to prevent what you want to do. But I'm not fully sure. –  Nicolas Goy Nov 8 '09 at 14:05
    
You might get better answers if you asked this question on serverfault.com –  chakrit Nov 8 '09 at 14:10
    
@Nicolas please let me know that option, I am not able to find it in man page of openssh client. @chakrit I thought this as scripting question thats why I asked it here. –  vinit dhatrak Nov 8 '09 at 14:12
    
You might also have a look at: stackoverflow.com/questions/459182/… last answer. –  Nicolas Goy Nov 8 '09 at 14:12
    
@Nicolas The answer mention use of another client like putty, but I want to use openssh client. –  vinit dhatrak Nov 8 '09 at 14:15
show 3 more comments

migrated from stackoverflow.com Nov 8 '09 at 14:25

This question came from our site for professional and enthusiast programmers.

6 Answers

I would have say to use RSA key or try this one: http://bash.cyberciti.biz/security/expect-ssh-login-script/ bare in mind that you need to install expect tool.

But since you have say NO to RSA and to expect, the only way is to write your own script utilizing Twisted's conch (http://twistedmatrix.com/projects/conch/documentation/examples/) or any other platform available which offer SSH implementation such as ruby or Perl

share|improve this answer
    
I dont want expect script. Please read my question carefully. –  vinit dhatrak Nov 8 '09 at 14:10
    
answer revised ;~) –  Tzury Bar Yochay Nov 8 '09 at 14:20
add comment

You could try host-based authentication to log in without a password. In this case you don't need a private key for the user. But you still need a host key. Would this be a possible solution for you?

The man page of ssh sais:

Host-based authentication works as follows: If the machine the user logs in from is listed in /etc/hosts.equiv or /etc/ssh/shosts.equiv on the remote machine, and the user names are the same on both sides, or if the files ~/.rhosts or ~/.shosts exist in the user's home directory on the remote machine and contain a line containing the name of the client machine and the name of the user on that machine, the user is considered for login. Additionally, the server must be able to verify the client's host key (see the description of /etc/ssh/ssh_known_hosts and ~/.ssh/known_hosts, below) for login to be permitted. This authentication method closes security holes due to IP spoofing, DNS spoofing, and routing spoofing. [Note to the administrator: /etc/hosts.equiv, ~/.rhosts, and the rlogin/rsh protocol in general, are inherently insecure and should be disabled if security is desired.]

share|improve this answer
add comment

If you are familiar with Python, you can try paramiko.

share|improve this answer
add comment

In debian and derivatives, there's a package called sshpass (website here) that's designed to do exactly that.

share|improve this answer
add comment

You can also use The dropbear SSH client, which allows specifying the password on the command line, like this: Dropbear for automatic login for shell scripts

share|improve this answer
add comment

Have a look at the ControlMaster option in ssh_config. This allows you to open a authenticated tunnel by hand that all following ssh connections uses.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.