Method One, login with user name password
On the command line, enter the command:
SSH [Email protected]_address-p Port
After that, you will be prompted to enter a password, you can log in, and if you do not add the-P option, the default is 22 port.
You can also enter a user name using the-L option:
ssh -l username ip_address-p Port
Method Two, use the key to log in (do not use the password)
First generate the key and enter the command in any directory:
Ssh-keygen "'
-p denotes password,-p ' indicates null password
You will then be prompted to enter the file name of the generated key file, you can enter any name, such as Id_rsa, enter. The system generates ID_RSA and id_rsa.pub two files in the current directory .
In the root directory , create a new. SSH folder and copy the generated key file to the past. Linux is the root directory; Windows is the user root directory (e.g. C:\Users\Jorzy)
mkdir -P ~/. SSH CP id_rsa* ~/. SSH/
The-p option means that the folder is no longer new if it already exists
Then copy the previously generated two files to the. SSH folder
Also copy the public key file id_rsa.pub to the server that needs to log on, using the SCP command
SCP -P port ~/. ssh/id_rsa.pub [email protected]_address:~
-P indicates the port number to log on to the server without default of 22
After that, you will be prompted to enter your password and you can complete the copy
Log on to the remote server, create a new. SSH folder (if not present) in the user's root directory, and add the id_rsa.pub to the Authorized_keys file if it does not exist in the Authorized_keys file
(In fact, it is to copy the contents of the id_rsa.pub into the Authorized_keys file, can be manually operated)
mkdir -P ~/. SSH cat id_rsa.pub >>. ssh/authorized_keys
Add the Id_rsa.pub file to the Authorized_keys file (new If the file does not exist)
Note: To ensure that the. SSH and Authorized_keys users have write access to their own
Exit the current remote login, and then log in remotely without using a password
Remote Server login command (SSH) under Linux