If your local username is different than your remote host it may be frustrating to type that username at each connection. Luckily, ssh comes with a config file that we can adjust.
Create the config file under
Edit the file as such:
Host myDomain.com User foo Host *.myAnotherDomain User bar Host * User foobar
You can use asterisk to match all hosts or subdomains. The configuration above will use
barfor all subdomains under
foobarfor any host that doesn’t match with above.
Note for Windows Users
However, that GNU tools come with their own home directory. So, if you are using MinGW Shell, then your home directory is may not be your Windows home directory. Type
printenv | grep HOME and it will show your POSIX home directory. So, if you are using MinGW shell for ssh, you should create that config under that directory. Otherwise, your good old Windows Home
Enjoy hacking 🙂