Enable SSH Service on CentOS
To enable SSH service on CentOS, you can follow these steps:
- Firstly, log in to your CentOS server. You can use an SSH client or operate directly on the server.
- Check if the SSH service is installed. Enter the following command to check if the OpenSSH server is installed:
sudo systemctl status sshd
If the service status shows as “active (running)”, it means the SSH service is already running.
- If the SSH service is not installed, you can use the following command to install the OpenSSH server:
sudo yum install openssh-server
- After the installation is completed, you can start the SSH service using the following command:
sudo systemctl start sshd
- If you want the SSH service to start automatically when the system boots up, you can use the following command to set it to start at boot:
sudo systemctl enable sshd
- Make sure the firewall allows SSH connections. You can open the SSH port (default is 22) using the following command:
sudo firewall-cmd --zone=public --add-port=22/tcp --permanent
sudo firewall-cmd --reload
The SSH service on your CentOS server should now be up and running, allowing access through SSH connections.