1. 用 VIM 打开 /etc/apt/source.list
- [email protected]:~# VIM /etc/apt/sources.list
- # 中科大
- deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
- deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
- # 阿里云
- deb http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
- deb-src http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
- # 清华大学
- deb http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
- deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
- # 浙大
- deb http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
- deb-src http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
- # 东软大学
- deb http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
- deb-src http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
- # 官方源
- deb http://http.kali.org/kali kali-rolling main non-free contrib
- deb-src http://http.kali.org/kali kali-rolling main non-free contrib
- deb http://mirrors.163.com/debian/ jessie main non-free contrib
- deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib
- deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib
- deb-src http://mirrors.163.com/debian/ jessie main non-free contrib
- deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib
- deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib
- deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
- deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
2. 执行下面操作, 进行更新, 安装, 删除包和重启虚拟机.
- apt-get update # 取回更新的软件包列表信息
- apt-get upgrade # 进行一次升级
- apt-get clean # 删除已经下载的安装包
- reboot #重启
3. 安装完之后查看更新完毕, 当前 Kali Linux 的版本和内核信息.
- [email protected]:~# cat /etc/issue
- Kali GNU/Linux Rolling \n \l
- root@kali:~# lsb_release -a // 查看当前发行版本
- No LSB modules are available.
- Distributor ID: Kali
- Description: Kali GNU/Linux Rolling
- Release: 2019.4
- Codename: kali-rolling
- root@kali:~# uname -a // 查看内核信息
- Linux kali 5.3.0-kali3-amd64 #1 SMP Debian 5.3.15-1kali1 (2019-12-09) x86_64 GNU/Linux
可以看出我已经由原来的 2018.2 版本更新到 2019.4 月份的版本, 前提是在没有改变原本安装的镜像前提下.
4. 开始安装 SSH 服务, 和 Xshell 进行连接.
[email protected]:~# apt-get install SSH
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
SSH 已经是最新版 (1:8.1p1-1).
下列软件包是自动安装的并且现在不需要了:
5. 修改 SSH 服务的配置文件, 在第 32 行的下面插入 PermitRootLogin yes, 取消第 57 行的注释, 把 no 改为 yes
- vi /etc/SSH/sshd_config
- 32 #PermitRootLogin prohibit-password
- 33 PermitRootLogin yes
- 56 # To disable tunneled clear text passwords, change to no here!
- 57 PasswordAuthentication yes
6. 修改完配置文件后, 开启 SSH 服务, 设置开机启动, 停止 SSH 服务, 查看 SSH 状态.
- [email protected]:~# service SSH start // 开启 SSH 服务
- [email protected]:~# service SSH stop //t 停止 SSH 服务
- [email protected]:~# update-rc.d SSH enable // 设置开机自启动
- [email protected]:~# service SSH status // 查看 SSH 服务的状态
● SSH.service - OpenBSD Secure Shell server
- Loaded: loaded (/lib/systemd/system/SSH.service; enabled; vendor preset: disabled)
- Active: active (running) since Thu 2019-12-19 23:00:55 CST; 19s ago
- Docs: man:sshd(8)
- man:sshd_config(5)
- Main PID: 2866 (sshd)
- Tasks: 1 (limit: 2305)
- Memory: 1.3M
- CGroup: /system.slice/SSH.service
└─2866 /usr/sbin/sshd -D
12 月 19 23:00:55 kali systemd[1]: Starting OpenBSD Secure Shell server...
12 月 19 23:00:55 kali sshd[2866]: Server listening on 0.0.0.0 port 22.
12 月 19 23:00:55 kali sshd[2866]: Server listening on :: port 22.
12 月 19 23:00:55 kali systemd[1]: Started OpenBSD Secure Shell server.
7. 查看 kali Linux 的 IP 地址, 便于和 Xshell 进行链接.
- [email protected]:~# ifconfig // 查看 IP 地址
- eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
- .NET 192.168.2.51 netmask 255.255.255.0 broadcast 192.168.2.255 // 可以看出 IP 地址是 192.168.2.5
8. 和 Xshell 进行连接, 名称可以随便起, 但是在虚拟机很多的情况下便于分辨起的名称最好和虚拟机一致, 主机就是本机的 IP 地址; 接着设置用户名和密码, 修改字体大小等.
从下图中可以看出连接成功.
来源: http://www.bubuko.com/infodetail-3340605.html