Putty connection to CentOS connection is denied

Source: Internet
Author: User

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

Related Article

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.