« Why should we deamonise a process in Linux?Linux Memory Technology Device mounting by label »

SSH to a server running on a non-standard port or different username

  08/02/19 18:23, by , Categories: Linux
SSH to a server running on a non-standard port or different username

Usually to SSH into a server we use the following command ...

ssh [hostname]

And then we log into the server.

However when the server isn't running on the default TCP port (22) or when our local username isn't the same as our account on the remote server we have to do something like this ...

ssh [username]@[hostname] -p [port]

If we regularly log-in to this server from the same machine there is a way to just use the 1st way even though the username and port is different.

We create or edit our local SSH config file.

vim ~/.ssh/config


Host [hostname]
     HostName [hostname]
     Port [port]
     User [username]

 

Now we can just ssh [hostname] and the correct remote username and port will be used.

 

No feedback yet


Form is loading...

December 2021
Mon Tue Wed Thu Fri Sat Sun
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
 << <   > >>

Search

Random photo

SSH to a server running on a non-standard port or different username

  XML Feeds

CCMS
 

This collection ©2021 by Simon Gaynor

Contact | Help | Blog template by Asevo | Run your own website!