How Do You Configure Linux CentOS 6.x to Accept SSH Connections?

Problem scenario
You try to use PuTTY to connect to a Linux CentOS 6.x server. You get the message "Network error: Connection refused." What should you do?

This assumes that there is no software or hardware firewall blocking port 22. You may want to use nmap or a Windows PowerShell port tester to verify port 22 is open. If iptables is blocking port 22, this will not work until you reconfigure iptables.


  1. Go to the Linux CentOS server.
  2. Modify the /etc/ssh/sshd_config file. Make sure that the
    "PasswordAuthentication" and "ChallengeResponseAuthentication" stanzas are set to yes. Make sure that they are not commented out (with a leading "#"). Make sure that the corresponding stanzas for "no" are commented out (with a leading "#").
  3. Run this command: sudo service sshd restart
  4. If you want the ssh daemon to be listening upon every reboot, create a crontab entry with the root user like this: @reboot /sbin/service sshd restart

Leave a comment

Your email address will not be published. Required fields are marked *