Linux開啟ssh
1.Ubuntu開啟ssh服務及允許root登錄
- 安裝ssh服務器端
- Ubuntu默認沒有安裝ssh的server,需要安裝
apt-get install openssh-server
- ssh客戶端是默認安裝的,安裝包:openssh-client,apt安裝
- 允許遠程使用root賬號ssh登入
- 修改/etc/ssh/sshd_config文件,修改如下:
#PermitRootLogin prohibit-password
PermitRootLogin yes
- 需要重啟系統或者sshd服務
1.sudo /etc/init.d/ssh stop
2.sudo /etc/init.d/ssh start
3.sudo service ssh start
- 安裝ssh服務后,系統默認開啟系統sshd,查看sshd狀態如果不是默認啟動,修改服務為enable
sudo systemctl enable ssh
2.CentOS開啟SSH服務
1.安裝openssh-server
yum list installed |grep openssh-server
如果有輸出,證明已經安裝了openssh-server,如果沒有,需要安裝
yum install openssh-server
2.修改sshd服務配置文件
- 編輯sshd服務配置文件
vi /etc/ssh/sshd_config
- 開啟監聽端口
Port 22
ListenAddress 0.0.0.0
ListenAddress ::
- 允許遠程登錄
PermitRootLogin yes
- 使用用戶名密碼作為驗證連接
PasswordAuthentication yes
- 開啟sshd服務
service sshd start
- 配置開機自啟動
systemctl enable sshd
3.Kalilinux開啟ssh
添加ssh開機自啟動
1.查看ssh的運行狀態
/etc/init.d/ssh status
2.啟動ssh
/etc/init.d/ssh start
3.開機自啟動配置
1.systemctl enable ssh.service2.或update-rc.d ssh enable
修改配置讓ssh允許root登錄
1.配置ssh配置文件
vi /etc/ssh/sshd_config
2.找到配置
原來這行:PermitRootLogin prohibit-password修改成這行:PermitRootLogin yes
3.保存退出,重啟ssh服務
/etc/init.d/ssh restart