2

When running the command:

ssh minix.p

what I really want run is:

sshpass -f ~/.ssh/minix-password ssh minix.p

Is there any way I can do that?

Background

I want to use sshfs and similar tools, so I cannot just make a script called sshminix - it really has to literally be the exact letters ssh minix.p that executes the above. On top of that the minix installation I have access to only supports password authentication, so I cannot used normal ssh public keys or ssh-agent.

Ole Tange
  • 33,591
  • 31
  • 102
  • 198
  • 3
    Why not just use an alias? – Nasir Riley Sep 16 '18 at 13:29
  • @NasirRiley How? `ssh not-minix` should still run `ssh not-minix`. – Ole Tange Sep 16 '18 at 13:45
  • 2
    Why not us a ssh key? – RalfFriedl Sep 16 '18 at 14:23
  • You said that you want to run `sshpass -f ~/.ssh/minix-password ssh minix.p`. Why not just create an alias that runs that command? – Nasir Riley Sep 16 '18 at 17:12
  • 2
    @RalfFriedl As written: "the minix installation I have access to only supports password authentication". – Ole Tange Sep 16 '18 at 21:44
  • @NasirRiley The programs I use will call `ssh `, so I need the syntax to be `ssh minix` and not some other command. This is also the reason I do not just simply make a script called 'sshminix' or some other name. – Ole Tange Sep 16 '18 at 22:00
  • You can still use an alias: `mssh = "sshpass -f ~/.ssh/minix-password ssh minix.p"`. You can make one for each host you want to connect to via `ssh`. If the host is called "gummibear" then you can use an alias: `gssh = "sshpass -f ~/.ssh/gummibear-password ssh gummibear.p"`. – Nasir Riley Sep 16 '18 at 23:09
  • @NasirRiley The problem is that *I* do not call `ssh minix`. It is another tool that call that (Think tools like `sshfs`). And I cannot change the tool to run `gssh` instead, because it uses `ssh ` with different hostnames. Show me how your solution will work with `sshfs`. – Ole Tange Sep 16 '18 at 23:32
  • 1
    Then you need to clarify what you are doing in your question. With the way it's written, it looks like you are only running a command. Include what you are doing in its entirety including the program that is running. – Nasir Riley Sep 16 '18 at 23:34

1 Answers1

1

You cannot provide a password in the SSH configuration, but you could run sshfs -o ssh_command=minixsshwrapper with minixsshwrapper being a script like:

#!/bin/sh
exec sshpass -f ~/.ssh/minix-password ssh "$@"

If changing the sshfs arguments is not possible then you could create the wrapper script as ssh in a directory to be added in fron of $PATH.

Marco d'Itri
  • 488
  • 4
  • 12