Linux普通使用者無法遠端連線的原因

來源:互聯網
上載者:User

標籤:作業系統   securecrt   使用者   連接埠號碼   

作業系統:CentOS6.5

遠端連線工具:SecureCRTV7.0

生產環境實戰任務:禁止遠程“root”賬戶串連,通過普通“sky”賬戶遠端連線,同時修改預設遠程連接埠號碼“22”。

操作步驟:

1.  建立普通使用者:

[[email protected]~]# useradd sky

[[email protected]~]# passwd sky

2.  修改設定檔:sshd_config

[[email protected]~]# vi /etc/ssh/sshd_config

#Port22    #去掉該行的注釋,並修改自己所需要的連接埠號碼

#PermitRootLogin  yes  #修改成PermitRootLogin no 

#修改之後進行儲存,還要注意幾點:

a)       [[email protected] ~]#iptables  -A  INPUT -p tcp -m state --stateNEW -m tcp --dport 9899  -j  ACCEPT  #允許連接埠號碼通過防火牆

b)       [[email protected] ~]#/etc/init.d/iptables save  #儲存到檔案,永遠生效

c)       [[email protected] ~]# /etc/init.d/iptables restart  #重啟生效

d)       [[email protected] ~]# service  sshd  restart    #重啟生效

    到此步,所有操作完成,不僅”root”賬戶無法遠端連線,而普通賬戶”sky”也無法遠端連線。這不是我們的要的效果,這到底是什麼原因呢?

 650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/59/55/wKiom1TQUPmQyqHIAAMccJDVCLQ556.jpg" style="float:left;" title="未命名.JPG" alt="wKiom1TQUPmQyqHIAAMccJDVCLQ556.jpg" /> 

3.錯誤顯示如下:

Theserver has disconnected with an error. Server message reads:

Aprotocol error occurred. Change of username or service not allowed:(root,ssh-connection) -> (sky,ssh-connection)

    通過反覆驗證,問題就出現在SecureCRT的設定上,在此對話方塊要做兩件事情:

a)    更改預設連接埠號碼“22”,改成“9899”

b)    更改使用者名稱“root”,改成“sky”或者是空白

c)    如果預設使用者名,在串連對話方塊中修改成“sky”也是認為預設使用者名。

最後可以用普通賬戶遠端連線:

  Last login: Tue Feb  3 12:17:13 2015 from 117.40.239.12

[[email protected]~]$


本文出自 “Linux~DBA~MBA” 部落格,請務必保留此出處http://sky9896.blog.51cto.com/2330653/1611065

Linux普通使用者無法遠端連線的原因

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.