3

Suppose I've got a server foo.com which only allows keyboard-interactive authentication, and that I can't change this. This means I can do,

sshpass -p PASSWORD ssh foo.com

but I can't create public/private keys to log in without a password.

Now, I could just create an alias ssh_foo="sshpass -p PASSWORD ssh foo.com", but then I have to create aliases for scp, for sftp, and in general it won't work for any other programs that use these, e.g. graphical programs based on sftp which mount remote folders. So I'm looking for a more generic solution.

In particular, is there any way to set up my .ssh/config file to allow password-less login in this case? This should then work for everything. I feel like some clever combination of ProxyCommand and LocalCommand might do it, but I can't figure out what.

(Note, I do understand the security implication of this, I'm just curious if you can do it)

marius
  • 1,352
  • 1
  • 13
  • 29
  • 2
    While the bounty is a nice touch with all the close votes coming in, you should consider moving to one of the more appropriate sister sites. Either super user or server fault are better options than stack overflow. Not saying your question isn't interesting, just wrong venue – Mad Physicist Sep 02 '19 at 01:48
  • 1
    See if this works for you? https://unix.stackexchange.com/questions/469387/sshpass-in-ssh-config – Tarun Lalwani Sep 02 '19 at 19:52
  • https://stackoverflow.com/a/43526842/13317 – Kenster Sep 05 '19 at 22:29

1 Answers1

0

Have you attempted using expect? According to the documentation it "[Expect] is a tool for automating interactive applications such as telnet, ftp, passwd, fsck, rlogin, tip, etc."

The Wiki Page for except is also a very good resource for examples as the ones on the Expect page are broken.

You can also use plink which you can download and compile. You can use the -pw argument to automate this.

maniSidhu98
  • 527
  • 2
  • 9