CentOSSSH installation and configuration

Source: Internet
Author: User
SSH is short for SecureShell, developed by the IETF Network team (NetworkWorkingGroup). SSH is a security protocol built on the application layer and transport layer. Traditional network service programs, such as FTP, POP, and Telnet, are inherently insecure because they transmit data, user accounts, and user passwords in plaintext over the network, attackers are vulnerable to man-in-the-middle attacks. There is another person or one

SSH is short for Secure Shell, developed by the Network Working Group of IETF. SSH is a security protocol built on the application layer and transport layer.

Traditional network service programs, such as FTP, POP, and Telnet, are inherently insecure because they transmit data, user accounts, and user passwords in plaintext over the network, attackers are vulnerable to man-in-the-middle attacks. There is another person or a machine impersonating a real server to receive data from the user to the server, and then impersonating the user to pass the data to the real server.

SSH is a reliable protocol designed for remote logon sessions and other network services. The SSH protocol can effectively prevent information leakage during remote management. SSH can be used to encrypt all transmitted data and prevent DNS spoofing and IP spoofing.

Install SSH:

Yum install ssh

Start SSH:

Service sshd start

Set the startup to run:

Chkconfig sshd on


OpenSSH is installed on CentOS by default, even if you install it with minimal effort.

SSH configuration:

1. modify vi/etc/ssh/sshd_config, and delete and modify the parameter values according to the parameter annotations to be modified in the template:

Port 22 specifies the Port number of the SSH connection. We do not recommend that you use the default Port 22 for security.

Protocol allows connection between SSH1 and SSH2. we recommend that you set this parameter to Protocal 2.

Other parameters are adjusted as needed. For the configuration method, see man ssh_config.

2. modify hosts. deny and add a line at the end:

Sshd: All

3. modify hosts. allow to add a line at the end:

Sshd: All

If you want to install an IP address that can restrict access, set it as follows:

Sshd: 192.168.0.101

Sshd: 192.168.0.102

The above configuration indicates that only 101 and 102 servers are allowed for SSH connection.

4. start SSH

/Etc/init. d/sshd start

Now SSH can be connected.

Enter the connection IP address

Enter the user name to connect to the server.

However, at present, we still need to enter a password for SSH connection. The following describes how to use a key to connect, saving the trouble of entering a password:

1. create a key on the managed machine

[Root @ localhost ~] # Mkdir/root/. ssh [root @ localhost ~] # Ssh-keygen-t rsaGenerating public/private rsa key pair. enter file in which to save the key (/root /. ssh/id_rsa): # Enter the default path Enter passphrase (empty for no passphrase): # Enter the password phrase Enter same passphrase again: # repeated password phrase Your identification has been saved in/root /. ssh/id_rsa. # if an error is reported here because SeLinux is caused by the following Policy: yum install selinux-policyYour public key has been saved in/root /. ssh/id_rsa.pub.The key fingerprint is: aa: 76: 71: 1e: 51: fe: 3b: 4c: 51: 30: b2: 90: 55: e9: 58: 7c root@localhost.localdomainThe key's randomart image is: + -- [RSA 2048] ---- + |. ooo + o |... o +. E | o. + o |. o | S... | .. o |. +. o. | .... + | .... | + --------------- +

2. putty production key

Open puttygen. if you do not have this program, you can download it from the official putty website.

Click Generate. in the red box, move the mouse to see that the key generation is complete.

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.