导致xshell等其他连接工具无法连接
操作如下
2020版本的kali默认创建的时候没有root账户
sudo -i
密码:你自己创建账号的密码
切换到root账户 获取权限
vim /etc/ssh/sshd_config编辑sshd配置文件
找到#PermitRootLogin prohibit-password,把前面的#去掉,并且将“prohibit-password”修改为YES
找到PasswordAuthentication这一行,将前面的#号注释去掉,如果后面写的是no,需要修改成yes
Esc 退出编辑 ,输入:wq 回车,完成编辑
/etc/init.d/ssh restart
重启成功,进行连接
查看IP
root@kali:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:3b:f2:88 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.129/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0
valid_lft 1139sec preferred_lft 1139sec
inet6 fe80::20c:29ff:fe3b:f288/64 scope link noprefixroute
valid_lft forever preferred_lft forever
shell连接
[E:\Xshell\Sessions]$ ssh 192.168.1.129
设置ssh开机自启
root@kali:~# systemctl enable ssh.service
Synchronizing state of ssh.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ssh
Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service.
Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /lib/systemd/system/ssh.service.