简体   繁体   中英

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, ie 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, ie /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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM