root@kali:~# service ssh start
root@kali:~# vim /etc/ssh/sshd_config
注:Vim热键指南:i键插入内容,ESC键退出编辑,"wq" 保存并退出,Shift+zz键返回当前终端桌面!
去掉哈希注释#,修改文件属性:
Port 22
Hostkey /etc/ssh/ssh_host_rsa_key
Hostkey /etc/ssh/ssh_host_ecdsa_key
Hoskey /etc/ssh/ssh_host_ed25519_key
LoginGraceTime 0
PermitRootLogin prohibit-password
PermitRootLogin yes
PasswordAuthentication yes
TCPKeepAlive yes
ClientAliveInterval 60
root@kali:~# cat /etc/ssh/sshd_config
root@kali:~# cd /etc/ssh
root@kali:~# ls -l
查看当前SSH服务状态:
root@kali:~# service ssh restart
查看状态报错删除key:
sroot@kali:~# ervice ssh status
root@kali:~# ls -al ssh*key
root@kali:~# rm -rf ssh*key
重新生成主机密钥:
root@kali:~# ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
root@kali:~# ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
root@kali:~# ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key
重新开启ssh服务:
root@kali:~# service ssh restart
root@kali:~# service ssh status
查看防火墙状态:
root@kali:~# service iptables status
关闭防火墙:
root@kali:~# service iptables stop
root@kali:~# ssh root@ 192.168.0.104
系统自动启动SSH服务:
root@kali:~# update-rc.d ssh enable
关闭系统自动启动SSH服务:
root@kali:~# update-rc.d ssh disabled
root@kali:~# ifconfig
注:Service服务器上安装Putty进行内网穿透回连本机IP!
网友评论