ssh远程连接kali

ssh远程连接kali


1.首先安装ssh服务

root@kali:~# apt-get -y install ssh
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ssh is already the newest version (1:7.9p1-4).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
root@kali:~# 

这里提示我已经安装过

2.开启ssh服务

root@kali:~# systemctl start ssh
root@kali:~# 

3.开机自启ssh服务

root@kali:~# systemctl enable ssh
Synchronizing state of ssh.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ssh
root@kali:~# 

4.查看22号端口是否开启

root@kali:~# netstat -nlt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
root@kali:~# 

22号端口已开启


5.修改配置文件vim /etc/ssh/sshd_config

    虽然开启了22号端口,但还是不能访问。因为Kali采用的是 debian的内核, 默认情况下是无法通过 ssh 远程登录 root 用户
在这里插入图片描述
需要修改 ssh 的配置文件
    将PasswordAuthentication yes前面的注释“#”号删除

root@kali:~# vim /etc/ssh/sshd_config 
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no

并将#PermitRootLogin prohibit-password
在这里插入图片描述
改为PermitRootLogin yes
在这里插入图片描述
保存并退出
重启ssh服务

root@kali:~# systemctl restart ssh
root@kali:~# 

登录成功:在这里插入图片描述

发布了71 篇原创文章 · 获赞 33 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq_41490561/article/details/103014235