這篇文章主要講解了“Linux服務(wù)器怎么ssh登錄”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“Linux服務(wù)器怎么ssh登錄”吧!

成都創(chuàng)新互聯(lián)公司2013年至今,先為扎賚諾爾等服務(wù)建站,扎賚諾爾等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為扎賚諾爾企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。
Ssh登錄
Ssh是建立在應(yīng)用層和傳輸層的安全協(xié)議,專門為遠(yuǎn)程登錄回話和其他網(wǎng)絡(luò)服務(wù)提供安全性。利用ssh可以有效的防止遠(yuǎn)程管理中的信息泄露問題,同時(shí)ssh傳輸?shù)臄?shù)據(jù)是經(jīng)過壓縮的,可以加快傳輸速度。
1、啟動(dòng)sshd服務(wù)。Centos默認(rèn)已經(jīng)安裝了ssh,而且該服務(wù)默認(rèn)是啟動(dòng)的
[root@localhost wj]# rpm -qa | grep ssh
libssh3-1.4.2-1.el6.i686
openssh-askpass-5.3p1-94.el6.i686
openssh-server-5.3p1-94.el6.i686
openssh-clients-5.3p1-94.el6.i686
openssh-5.3p1-94.el6.i686
[root@localhost wj]# service sshd status
openssh-daemon (pid 1634) 正在運(yùn)行 ...
[root@localhost wj]#
|
2、測(cè)試登錄
[root@localhost wj]# ssh root@192.168.0.119
The authenticity of host '192.168.0.119 (192.168.0.119)' can't be established.
RSA key fingerprint is 36:20:c9:ab:88:1f:47:74:1b:f1:d7:47:55:e0:14:7c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.119' (RSA) to the list of known hosts.
root@192.168.0.119's password:
Last login: Fri Aug 10 14:57:45 2018
already login
[root@localhost ~]# exit
logout
Connection to 192.168.0.119 closed.
|
3、禁止root登錄
root用戶在Linux系統(tǒng)中擁有最高的權(quán)利,如果用root用戶登錄就意味著增大了系統(tǒng)的風(fēng)險(xiǎn)。Ssh默認(rèn)可以使用root登錄,為了安全考慮,我們可以禁止root登錄。
1)修改配置文件“/etc/ssh/sshd_config”,找到“permitRootLogin”將其改為no
[root@localhost wj]# gedit /etc/ssh/sshd_config
PermitRootLogin no // 這里默認(rèn)是 yes ,而且已經(jīng)被注釋掉了。取消注釋,改為 no
[root@localhost wj]# service sshd restart // 重啟服務(wù)
停止 sshd : [ 確定 ]
正在啟動(dòng) sshd : [ 確定 ]
[root@localhost wj]#
|
2)測(cè)試,使用root登錄,可以看到?jīng)]有權(quán)利
[root@localhost wj]# ssh root@192.168.0.119
root@192.168.0.119's password:
Permission denied, please try again.
|
4、設(shè)置指定用戶登錄
有時(shí)候?yàn)榱私档拖到y(tǒng)風(fēng)險(xiǎn),我們還會(huì)設(shè)置指定的用戶登錄,而其他用戶登錄就會(huì)拒絕。
1)修改配置文件“/etc/ssh/sshd_config”,在最后追加
[root@localhost wj]# gedit /etc/ssh/sshd_config
AllowUsers david // 允許 david 登錄
[root@localhost wj]# service sshd restart // 重啟服務(wù)
停止 sshd : [ 確定 ]
正在啟動(dòng) sshd : [ 確定 ]
[root@localhost wj]#
|
2)測(cè)試,分別使用david和weijie兩個(gè)用戶登錄,其中weijie會(huì)登錄失敗
[root@localhost wj]# ssh weijie@192.168.0.119
weijie@192.168.0.119's password:
Permission denied, please try again.
[root@localhost wj]# ssh david@192.168.0.119
david@192.168.0.119's password:
Last login: Wed Aug 15 17:12:59 2018 from 192.168.0.112
already login
|
感謝各位的閱讀,以上就是“Linux服務(wù)器怎么ssh登錄”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對(duì)Linux服務(wù)器怎么ssh登錄這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!
文章名稱:Linux服務(wù)器怎么ssh登錄-創(chuàng)新互聯(lián)
標(biāo)題鏈接:
http://www.weahome.cn/article/cdjdes.html