Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusion of filename with hostname #35

Open
HaleTom opened this issue Feb 20, 2017 · 3 comments
Open

Confusion of filename with hostname #35

HaleTom opened this issue Feb 20, 2017 · 3 comments

Comments

@HaleTom
Copy link

HaleTom commented Feb 20, 2017

#I'm using ssh-ident via a symlink. It confuses a filename with a hostname:

$ ls -l ~/bin/scp
lrwxrwxrwx 1 ravi ravi 18 Nov 24  2016 /home/ravi/bin/scp -> /usr/bin/ssh-ident
$ # Doesn't work:
$ ~/bin/scp stignoreandroid jnanidroid:ext
All keys already loaded
ssh: Could not resolve hostname stignoreandroid: Name or service not known
$ # But the unwrapped scp DOES work, with the same syntax
$ /usr/bin/scp stignoreandroid jnanidroid:ext
stignoreandroid                            100%  451     3.4KB/s   00:00    
$ 
@HaleTom
Copy link
Author

HaleTom commented Dec 17, 2017

I'm finding it hard to believe that a basic functionality of scp is broken - ie, copying a file to a remote server.

Surely there must be a work-around for this?

I updated the example in the top post to highlight that scp works but using ssh-ident doesn't.

@HaleTom
Copy link
Author

HaleTom commented Dec 17, 2017

Work around:

alias scp='BINARY_SSH=/usr/bin/scp scp'

Or to enable use from inside scripts, call the following script ~/bin/ssh-ident-wrapper, and symlink it as ~/bin/scp: and ~/bin/ssh:

#!/bin/bash
# Wrapper to make ssh-ident work properly.
# See https://github.com/ccontavalli/ssh-ident/issues/35
set -euo pipefail

name=$(basename "$0")

# Assume that this script is in the path before anything else.
# Take the 2nd command as the one to execute
binary=$(which -a "$name" | sed -n '2p')

BINARY_SSH="$binary" ssh-ident "$@"

Questions

  1. Why is this workaround required?
  2. Why doesn't setting $BINARY_DIR make any difference?

@HaleTom
Copy link
Author

HaleTom commented Sep 25, 2018

Would checking argv[0] == scp allow a work-around?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant