在虛擬機(jī)(Vmware Workstation)下,安裝了CentOS7,現(xiàn)在想通過SSH工具連接虛擬機(jī)中的CentOS7
1、 首先,要確保CentOS7安裝了 openssh-server,在終端中輸入 yum list installed | grep openssh-server
此處顯示已經(jīng)安裝了 openssh-server,如果又沒任何輸出顯示表示沒有安裝 openssh-server,通過輸入 yum install openssh-server
yum list installed | grep openssh-server
來進(jìn)行安裝openssh-server
2、 找到了 /etc/ssh/ 目錄下的sshd服務(wù)配置文件 sshd_config,用vi編輯器打開
將文件中,關(guān)于監(jiān)聽端口、監(jiān)聽地址前的 # 號(hào)去除
# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
Port 22
#AddressFamily any
ListenAddress 0.0.0.0
ListenAddress ::
然后開啟允許遠(yuǎn)程登錄
# Authentication:
#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
最后,開啟使用用戶名密碼來作為連接驗(yàn)證
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes
保存文件,退出
3、 開啟 sshd 服務(wù),輸入 sudo service sshd restart文章來源:http://www.zghlxwxcb.cn/news/detail-509417.html
[root@jcgitlabsvr02 bin]# sudo service sshd restart
Redirecting to /bin/systemctl restart sshd.service
檢查 sshd 服務(wù)是否已經(jīng)開啟,輸入ps -e | grep sshd
[root@jcgitlabsvr02 bin]# ps -e | grep sshd
32642 ? 00:00:00 sshd
參考鏈接
https://blog.csdn.net/qq_41768362/article/details/117331798文章來源地址http://www.zghlxwxcb.cn/news/detail-509417.html
到了這里,關(guān)于Centos開啟SSH服務(wù)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!