Remote Server login command (SSH) under Linux

Source: Internet
Author: User
Tags scp command

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.