How to open SSH remote connection in CentOS

Source: Internet
Author: User
Tags vps ssh server

Assuming the VPS uses CentOS, then assume a newer version of 6.5.

There may not be a desktop installed on the VPS, but SSH is generally installed, and the firewall is open with 22 ports by default.

Let's start with SSH.

# install SSH, default is installed.

# yum Install SSH

# Start the SSH server side

# service sshd Start

# chkconfig sshd on

SSH Login

If the local side is Linux

# SSH [email protected]

Root is the login user name, 192.168.1.1 is the host's IP address, of course, you can also use the hostname, domain name to refer to the IP address.

# SSH 192.168.1.1

The user name of the current client will be logged in.

SSH Login without password

But every time I enter a password login is very troublesome, there is no way to let the server can determine my identity, no need to enter a password can be directly certified?

In addition to using password Authentication, SSH provides a way to verify public and private keys. The client generates a private key, generates a corresponding public key, and then uploads the public key to the server. Here is the Linux sample.

Generate the private key, public key on the client (note, done on the client):

# ssh-keygen-t RSA

-t specifies the type of key to be created, which is RSA by default, so only execute Ssh-keygen is the same.

You will be prompted to enter the encryption password for your private key. If you need to completely detach the password, you can leave it blank and enter directly, otherwise each connection needs to be unlocked locally.

When finished, two files are generated under the ~/.ssh/path under the current user's home directory Id_rsa and Id_rsa.pub are private and public keys respectively.

Next, to upload the generated public key to the server, the following code is also executed on the client.

# ssh-copy-id-i ~/.ssh/id_rsa.pub [email protected]

Where root can be modified as the server-side user name that you want to log on automatically, 192.168.1.1 modified to your VPS hostname or IP address.

Finally, SSH logs on to the remote server.

# SSH [email protected]

At this point you do not need a password to log in.

How to open SSH remote connection in CentOS

Related Article

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.