[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Can SSH Default to Different Usernames Based on Remote Host?



> > I can "ssh remote0" and am able to log in without further prompting.
> > All works well.  On the other hand, I have to specify my username in
> > "ssh foo@remote1" when connecting to "remote1".  This is, of course,
> > because my username on "workstation" and "remote1" differ.
> > 
> > I'm curious if there is a way I can configure ssh to automatically use
> > the username "foo" when connecting to "remote1".
> 
> Yes; refer to the manpage for ssh_config. In short, create 
> $HOME/.ssh/config with an entrie like
> 
> Host remote1
> User foo

Beautiful!  I've used .ssh/config to enable ForwardX11 as needed but
didn't think to look for a User option.  This works perfectly.

Thank you for pointing this out!

-Jeff



Reply to: