Home > System Tutorial > LINUX > body text

Install SSH and SSH service on CentOS

WBOY
Release: 2024-02-11 08:00:23
forward
581 people have browsed it

Preface

php editor Xinyi brings you a tutorial on installing SSH and SSH services on CentOS. SSH is a secure remote login protocol through which servers can be remotely managed securely on the network. This article will introduce in detail the steps of how to install SSH and SSH service under CentOS system to help readers quickly master this skill. Whether you are a novice or an experienced administrator, you can easily learn to install SSH through this article and enjoy the convenience and security brought by SSH. Read this article and let’s start exploring CentOS installation of SSH and SSH services!

Install SSH and SSH service on CentOS

Install SSH

1. Open the terminal and use the following command to install SSH:

```shell

sudo yum install openssh-server

```

2. After the installation is complete, use the following command to start the SSH service:

sudo systemctl start sshd

3. You can use the following command to check the SSH service status:

sudo systemctl status sshd

If you see "active (running)", the installation is successful.

Configure SSH service

1. Open the SSH configuration file using the following command:

sudo vi /etc/ssh/sshd_config

2. In the file Find the following two lines of code, uncomment and modify them as follows:

RSAAuthentication yes

PubkeyAuthentication yes

3. Add the following code at the end of the file to specify the public key storage Directory:

AuthorizedKeysFile .ssh/authorized_keys

4. Save and exit the file, restart the SSH service:

sudo systemctl restart sshd

Generate SSH keys

1. To generate an SSH key pair on the client, use the following command:

ssh-keygen -t rsa

Press the Enter key all the way to generate a key pair .

2. Copy the public key to the server, use the following command:

ssh-copy-id username@server_ip

username is the server username, server_ip is the server IP address , after entering the server password, the public key can be copied to the server.

We have successfully installed SSH and configured the SSH service. Using SSH keys to log in can provide better security and avoid the risk of passwords being violently cracked. I hope the introduction in this article can be helpful to everyone. , if you have any questions or suggestions, please feel free to contact us and share a little LINUX knowledge: In the LINUX system, use the "man" command to view the help documentation of the command, for example, "man ssh" can view the help documentation of the ssh command.

The above is the detailed content of Install SSH and SSH service on CentOS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:xiaosiseo.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!