13
2
What is the entry I should add to my .bashrc
file so I can specify a default user for making SSH connections? For example, if I want it to be root and want to SSH to x, if I type ssh x
, it should default to a connection of ssh root@x
.
By default, Linux seems to default to whatever user you are logged in as. I.e., if I am logged in as "peter", typing ssh x
will result in a connection of ssh peter@x
.
Keep in mind I still want to override the default at times, so doing something like
alias ssh='ssh root@'
is not the most ideal solution.
1Note that when
ssh
scans the config file it will use the first match it finds, so put the least specific matches at the bottom of the file. – mwfearnley – 2017-11-24T09:55:14.707