45

Is it possible to specify password inside my .ssh/config file? Something like

Host host1
    User user1
    Pass password

All resources I found recommend to use keys instead, but that's not an option for me, I want to use password.

If it's not possible with stock openssh, are there any patches laying around that would allow this?

EDIT: reason I need to use password is to get access to network drives when connection to cygwin sshd from linux.

graywolf
  • 7,092
  • 7
  • 53
  • 77
  • 5
    you could also look into using [`sshpass`](http://linux.die.net/man/1/sshpass) – Matt Clark Sep 06 '16 at 16:35
  • @MattClark well tell that to windows. they won't unlock network drives unless you use password to log in. do I like it? no. do I have a choice? no. – graywolf Sep 06 '16 at 16:37
  • 1
    @MattClark thanks for the tip, will look into it :) – graywolf Sep 06 '16 at 16:38
  • You mention Windows network drives? I am confused as to your setup now, are the shares not via samba? Could you [edit] your post to provide some more details of your setup and use case? – Matt Clark Sep 06 '16 at 16:39
  • I'm connecting from linux machine to windows machine where there is sshd via cygwin.. and while you can use ssh keys to login into such setup, the windows session then doesn't have access to network drives, you need to login using password to get that. I didn't think that it is relevant to my problem, since I need to specify password on linux machine, the fact that on the other end is cygwin should be irrelevant.. but will put it into my question :) – graywolf Sep 06 '16 at 16:46
  • Possible duplicate of [Automatically enter SSH password with script](https://stackoverflow.com/questions/12202587/automatically-enter-ssh-password-with-script) – Omnifarious Oct 01 '18 at 23:50

1 Answers1

33

No, it is not possible. The configuration options are described in the manual page for ssh_config and there is no such option as Pass.

There are no patches (at least I didn't see any during the years yet), because it is very insecure to store passwords in plain text. Using some obfuscated method will not make it any more secure and real encryption would add here a lot of complexity (and a new encryption passphrase).

Really, use the SSH keys. They are cool, secure and easy to use. Just two commands to set up and third to use.

$ ssh-keygen -t rsa -P ""
$ ssh-copy-id server
$ ssh server
Jakuje
  • 24,773
  • 12
  • 69
  • 75
  • 5
    I cannot use ssh keys, windows won't unlock network drives unless you use password to log in :/ – graywolf Sep 06 '16 at 16:35
  • 13
    I need this too, can't use ssh keys, because the other system is read-only (it's a home vacuum cleaner, so it's just for fun) – raarts Jun 16 '17 at 07:05
  • 1
    The solution works for me and this help me, `$ssh-copy-id -i ~/.ssh/keyname username@hostip` – Junior Usca May 10 '19 at 16:55
  • What is the difference between storing passwords in plain text with storing privet keys in plain text? How one can be very insecure but not the other? – Peyman Jun 21 '23 at 19:56
  • @Peyman when you use SSH authentication you are sending the password over to the server. When you decrypt the private key locally, the passphrase is never leaving your computer. – Jakuje Jun 22 '23 at 12:36