操作系统
$ lsb_release --all
No LSB modules are available.
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2020.3
Codename: kali-rolling
启用 SSH 服务
kali 2020.3 默认没有启用 SSH 服务:
$ systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:sshd(8)
man:sshd_config(5)
可以执行命令 systemctl start ssh
启用 SSH 服务,随后再执行命令 systemctl status ssh
查看服务是否成功启用:
$ systemctl start ssh
$ systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2020-08-22 09:55:16 EDT; 25s ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 1174 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 1175 (sshd)
Tasks: 1 (limit: 2310)
Memory: 2.7M
CGroup: /system.slice/ssh.service
└─1175 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
执行命令 sudo systemctl enable ssh
可以设置 SSH 服务开机自启动:
$ sudo systemctl enable ssh
[sudo] password for kali: 密码
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.
如需允许超级用户登录,可以修改 /etc/ssh/sshd_config
配置文件,需将参数 PermitRootLogin
设为 yes
,允许超级用户登录:
PermitRootLogin yes