Kali Linux更新和配置
1.用vim打开 /etc/apt/source.list
root@kali:~# 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的版本和内核信息。
root@kali:~# 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进行连接。
root@kali:~# 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状态。
root@kali:~# service ssh start //开启ssh服务 root@kali:~# service ssh stop //t停止ssh服务 root@kali:~# update-rc.d ssh enable //设置开机自启动 root@kali:~# 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进行链接。
root@kali:~# ifconfig //查看IP地址 eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.2.51 netmask 255.255.255.0 broadcast 192.168.2.255 //可以看出IP地址是192.168.2.5