First check whether the SSHD service is enabled
Enter terminal input #ssh localhost
If prompted: Ssh:connect to host localhost port 22:connection refused error
No need to worry about it, no starting sshd service for the sake of
Install sshd command: #yum install Openssh-server
Open after installation: #/etc/init.d/sshd start or service sshd start
In case the connection does not go up at this time, firewall open 22 port can
#/sbin/iptables-i input-p TCP--dport 22-j ACCEPT
Then save it, be sure to save it first
#/etc/rc.d/init.d/iptables Save
#重启防火墙才生效
/etc/init.d/iptables restart
#查看防火墙信息
/etc/init.d/iptables status
If not, it should be an SSH configuration file problem/etc/ssh/sshd_config
Vi/etc/ssh/sshd_config
Add (I was empty before adding)
Passwordauthentication Yes (allows login with password)
Permitemptypasswords Yes (no blank password to log in)
Permitrootlogin Yes (allows the root user to log in using SSH)
Not yet......
The security configuration of the CentOS system default system leads to some puzzling problems, such as that SELinux was originally used for the security subsystem's permission control, but it is not possible to find a lot of restrictions, we can use the following methods to quickly close selinux.
/usr/sbin/setenforce 0 Close SELinux immediately
/usr/sbin/setenforce 1 Enable SELINUX now
Add to system default boot inside
echo "/usr/sbin/setenforce 0" >>/etc/rc.local
This allows us to quickly shut down when we don't need to open selinux in the CentOS system, and to turn it on when needed.
Putty connection to CentOS connection is denied