linux ssh alias login tips
- 2020-05-14 05:27:16
- OfStack
For easy access to the server, we use putty, SecureCRT and other tools. How do I use a server alias to log in at the terminal?
You can create ~/.ssh /config files and specify login information and authentication methods for each server, as follows:
$ vim ~/.ssh/config
Host www
HostName www.ttlsa.com
Port 22
User root
IdentityFile ~/.ssh/id_rsa.pub
IdentitiesOnly yes
Host bbs
HostName 115.28.45.104
User anotheruser
PubkeyAuthentication no
Then specify the alias directly to log in
Shell
$ ssh www
1 $ ssh www
Option notes:
HostName specifies the login hostname or IP address
Port specifies the port number for the login
User login username
IdentityFile login public key file
IdentitiesOnly only accepts SSH key logins
PubkeyAuthentication