[ale] Ssh config question

Jeremy T. Bouse jeremy.bouse at UnderGrid.net
Fri Feb 13 14:19:21 EST 2015


On 12.02.2015 10:09, Jim Lynch wrote:
> I have a backup being run on a system that then uses scp to copy the
> archive to another system.  The backup is running on system A as root
> and copies to system B as a normal user, e. g. scp backup.tar
> normal at B.example.com.  In my /root/.ssh/config file I have
>
> Host B.example.com
> Port 2222
>
> I did a ssh-copy-id normal at B.example.com AND
> ssh-copy-id B.example.com
>
> So ssh works fine to root at B.example.com but not to 
> normal at B.example.com
>
> If I change the ssh port back to 22 it works as advertised,
> connecting to either, but it won't connect to another user on
> B.example.com with an alternate port.  In the man page for 
> .ssh/config
> there is a User key word but I'm guessing that would force all
> connections to the host to use that user.
>
> Other than putting the port number on the command is there a way
> around this problem?
> scp -P 2222 backup.tar normal at B.example.com works.
>
> Thanks,
> Jim.

For an automated use like this my typical ~/.ssh/config file would be 
something along the lines of:

Host B.example.com
    HostName B.example.com
    User normal
    Port 2222
    IdentitiesOnly yes
    IdentityFile /path/to/id_file

I know technically the HostName value defaults to Host value but I 
enter to be explicit. I use IdentitiesOnly setting when I want to use a 
specific set of credentials and not use whatever the agent may know of 
and you can specify multiple IdentityFile entries or use the macros 
available even to specify any potential ones to use.


More information about the Ale mailing list