Linux open SSH port 22

1. Check whether openssh-server is installed, execute the command: yum list installed | grep openssh-server

If there is openssh-server, it is already installed, if not, you need to install it, execute the installation command: yum install openssh-server

 

2. Open the sshd configuration file sshd_config and execute the command: vi /etc/ssh/sshd_config 

Remove the comment before the listening port and address:

 

3. Turn on remote login:

 

4. Turn on the user password as connection verification, save and exit

 

5. Start the sshd service and execute the command: sudo service sshd start

  Stop SSH service command (service sshd stop)

  Restart the SSH service command (service sshd restart)

 

6. Check if port 22 is monitored, execute the command: netstat -nltp|grep 22

Check whether the SSH service is running, execute the command: /etc/init.d/sshd status

Check whether SSHD is set to start up under this run level.
Enter the command: chkconfig --list sshd
as shown in the figure. The SSH server in the centos 6 system has been set to start up under this run level. If it is not set to start, execute the command: chkconfig --level 2345 sshd on can be set

 

Set the SSH service to start at boot.
Enter the command: chkconfig sshd on.
If it is chkconfig sshd off, SSH startup is prohibited

 

7. Set IP, etc.:

virtual machine:

Host:

The virtual machine ip needs to be in the same network segment as the host VMnet8

Guess you like

Origin blog.csdn.net/zhangwenchao0814/article/details/108437631