Amelio Vazquez-Reina
Amelio Vazquez-Reina

Reputation: 96274

Emacs - Unable to tramp with a different username

I have the following setup in my ssh's config file:

Host my_username.remote
 User my_username
 HostName server.xxx.com
 IdentityFile ~/.ssh/general_id_rsa
 ControlMaster auto
 ControlPath ~/.ssh/%r@%h:%p        

Host different_username.remote
 User different_username
 HostName server.remote.net
 IdentityFile ~/.ssh/general_id_rsa
 ControlMaster auto
 ControlPath ~/.ssh/%r@%h:%p        

The above config works with no problem on the terminal, i.e. I can do ssh my_username.remote or ssh.different_username.remote and it will login on the remote server with the right credentials correctly.

However, when I do this in Emacs, I can login with my credentials, i.e. /ssh:my_username.remote:/, but not with /ssh:different_username.remote:/.

I should note that on my local machine I am also my_username. So the problem seems to come from using a different username.

Any thoughts on what's causing this?

Upvotes: 1

Views: 386

Answers (1)

phils
phils

Reputation: 73256

I'm fairly sure Tramp will supply default values when you don't specify parameters, in which case /ssh:different_username.remote would be translated to /ssh:my_username@different_username.remote.

I would think you'd be able to use /ssh:different_username@different_username.remote, even if it's not able to pick up the automatic config.

Upvotes: 2

Related Questions