Connect to a remote host using SSH

Source: Internet
Author: User

In Linux systems, SSH is the default tool for remote logins because the tool's protocol uses the RSA/DSA encryption algorithm. This tool is very secure for remote management of Linux systems.

SSH logon to the remote host (server) generally there are two ways: no key mode and a key method.

No key method needs to enter the password every time, and the key method only need to enter the password for the first time, no need to enter a password in the future to correctly login.

1 Installing SSH
    • Server side needs to install and turn on SSH service

    • Client side needs to support Ssh-keygen command

      The which command can be used to verify:

      which SSH

      Or, use the SSH command directly to view:

    • Confirm that two machines can connect to the Internet

2 using SSH 2.1 No Key mode

Use format: SSH user name @ host IP

The remote host IP is 192.168.31.116.

  

   

2.2 have a key way

① generating key pair (client side)

SSH ' -F ~/.ssh/id_rsa

After executing the above command, the hidden directory is generated in the current directory. SSH. Using the Ls-l (abbreviated LL) command, we found that two new files were generated: Id_rsa is the private key, and Id_rsa.pub is the public key.

It should be noted that the public key is public and does not require secrecy, while the private key is owned by the individual and must be kept and kept in mind.

② Add the client's public key to the server-side public key file for authentication

Ssh-copy-id [Email protected]_address

After executing the above command, you can see the Authorized_keys file generated under the user directory/.ssh directory on the server side.

③ Disable SSH login via password on server side

sudo vim/etc/ssh/sshd_config

After opening the file, uncomment the frame's statement (Allow automatic login with key):

④ Restart the SSH service:

sudo service ssh restart

⑤ SSH login on the client, found that no longer need to enter the password to log in directly.

SSH User name @ host IP

  

Connect to a remote host using SSH

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.