putty串連centos串連被拒絕

來源:互聯網
上載者:User

標籤:

首先檢查SSHD服務是否啟用

進入終端輸入 #ssh localhost

如果提示:ssh: connect to host localhost port 22: Connection refused 錯誤

不用管它,沒有啟動sshd服務的緣故

安裝sshd命令: #yum install openssh-server

安裝好後開啟: #/etc/init.d/sshd start  或者 service sshd start

萬一此時還是串連不上去,防火牆開放22連接埠即可

#/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT

然後儲存,一定要先儲存
#/etc/rc.d/init.d/iptables save

#重啟防火牆才生效
/etc/init.d/iptables restart

#查看防火牆資訊
/etc/init.d/iptables status

如果還不行應該是ssh設定檔的問題/etc/ssh/sshd_config

vi /etc/ssh/sshd_config

添加(我之前是清空再添加)

PasswordAuthentication yes (允許使用密碼方式登陸)
PermitEmptyPasswords yes   (禁止空密碼進行登陸)

PermitRootLogin yes (允許root使用者使用SSH登陸)

 

還不行......

CentOS系統預設系統的安全性配置導致些莫名其妙的問題,比如SElinux本來是用於安全子系統的許可權控制,可是搞不好就發現限制多多,我們可以用如下方法快速關閉SElinux。

  /usr/sbin/setenforce 0 立刻關閉SELINUX

  /usr/sbin/setenforce 1 立刻啟用 SELINUX


  加到系統預設啟動裡面

  echo "/usr/sbin/setenforce 0" >> /etc/rc.local


  這樣,我們在不需要在CentOS系統中開啟SELINUX的時候,就可以快速的去關閉了,以及在需要的時候,在開啟它。

 

putty串連centos串連被拒絕

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.