Home >Operation and Maintenance >Linux Operation and Maintenance >What is the method to log in with linux ssh alias?

What is the method to log in with linux ssh alias?

王林
王林forward
2023-05-15 20:52:121445browse

In order to facilitate login to the server, we generally use tools such as putty, securecrt and so on. How to log in through the server alias in the terminal?

You can create the ~/.ssh/config file and specify the login information and verification method for each server, as shown below:

$ 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 directly specify the alias to log in

shell
$ ssh www
1 $ ssh www
Option comments:

hostname specifies the login host name or ip address
port specifies the login port number
user login user Name
identityfile login public key file
identitiesonly only accepts ssh key login
pubkeyauthentication

The above is the detailed content of What is the method to log in with linux ssh alias?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete