ccontavalli / ssh-ident

Different agents and different keys for different projects, with ssh.
Other
965 stars 71 forks source link

Docs for scp usage seem incomplete #48

Open johnemb opened 6 years ago

johnemb commented 6 years ago

The documentation (README) for scp usage seems to be lacking something. In my environment, if I follow option 1) to make scp work with ssh-ident:

1) Rename 'ssh-ident' to 'ssh' or create a symlink 'ssh' pointing to ssh-ident in a directory in your PATH before /usr/bin or /bin ... If you want to use ssh-ident with scp or sftp, you can simply create symlinks for them as well:

   ln -s /path/to/ssh-ident ~/bin/scp
   ln -s /path/to/ssh-ident ~/bin/sftp

Then I get:

$ scp otherhost:mydir/file.test . ssh-ident found 'scp' as the next command to run. Based on argv[0] (/home/someuser/bin/scp), it seems like this will create a loop.

Please use BINARY_SSH, BINARY_DIR, or change the way ssh-ident is invoked (eg, a different argv[0]) to make it work correctly.

OK. Let's investigate the options.

BINARY_SSH has to be set to the binary (e.g. ssh or scp) to be used for the command in question, so it cannot be fixed ahead of time. One could use an alias, but then we are into documented option 2), which has its drawbacks.

BINARY_DIR, what is that? Well, it is not documented. It turns out that setting it to the location of scp, e.g. /usr/bin, makes the symlink solution work.

https://github.com/ccontavalli/ssh-ident/commit/3267764ee94a1e9988106472e82bec1a7683c27b seems to explain quite a bit of it, but I am not sure about one thing:

Is option 1) mentioned above (using symlinks for scp, sftp) supposed to work without setting BINARY_DIR? If so, under which circumstances? Or, is BINARY_DIR a prerequisite for using scp, sftp with symlinks, given no other solutions?

maddes-b commented 2 years ago

Typically this is a problem in the setup, either environment or using multiple ssh-ident symlinks for an binary.