Default SSH user on Linux

A better solution than putting an alias in your bashrc, would be to use a ssh config file

cat ~/.ssh/config

HOST *  
     USER root

You can also specify certain subdomains use certain users. Useful if your laptop travels between networks.

HOST 192.168.*.*
     USER homeuser

HOST 10.2.*.*
     USER workuser

You could even configure by domains, and use different ssh keys for different domains.

HOST *.microsoft.com
     USER bill
     IdentityFile ~/.ssh/microsoft/id_rsa

HOST *.apple.com
     USER steve
     IdentityFile ~/.ssh/apple/id_rsa

You can also add sections that apply to multiple hosts, e.g.

HOST rasbpi1 rasbpi2 rasbpi3
    USER pi

Read more about the format by executing man ssh_config or here

Tags:

Ssh