Kali安装VNC


Kali安装VNC

系统信息

┌──(root㉿Kali)-[/etc/kernel]
└─PS> lsb_release -a                                                         
No LSB modules are available.
Distributor ID: Kali
Description:    Kali GNU/Linux Rolling
Release:        2022.3
Codename:       kali-rolling

1、切换到root用户更新源,否则安装vnc会提示权限不够

┌──(pony㉿Kali)-[~]
└─$ apt update          
正在读取软件包列表... 完成
E: 无法打开锁文件 /var/lib/apt/lists/lock - open (13: 权限不够)
E: 无法对目录 /var/lib/apt/lists/ 加锁
W: 用 unlink 删除文件 /var/cache/apt/pkgcache.bin 出错 - RemoveCaches (13: 权限不够)
W: 用 unlink 删除文件 /var/cache/apt/srcpkgcache.bin 出错 - RemoveCaches (13: 权限不够)

2、安装tightvncserver

最新版的kali源已经没有vnc-server了,安装tightvncserver.

┌──(root㉿Kali)-[~]
└─# apt install tightvncserver    

3、设置密码

root@kali:~# tightvncserver 

You will require a password to access your desktops.

Password: 
Verify:   
Would you like to enter a view-only password (y/n)? n

4、写脚本启动VNC Server

root@kali:~#nano /etc/init.d/vncboot

将这个网址的代码复制过来。脚本代码网址。此处搬运国外油管up主“Fuzz The Pi Guy”。不方便翻墙的童鞋脚本代码粘贴如下:

#!/bin/sh
### BEGIN INIT INFO
# Provides: vncboot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC Server at boot time
# Description: Start VNC Server at boot time.
### END INIT INFO

USER=root
HOME=/root

export USER HOME

case "$1" in
start)
echo "Starting VNC Server"
#Insert your favoured settings for a VNC session
/usr/bin/vncserver :0 -geometry 1280x800 -depth 16 -pixelformat rgb565
;;

stop)
echo "Stopping VNC Server"
/usr/bin/vncserver -kill :0
;;

*)
echo "Usage: /etc/init.d/vncboot {start|stop}"
exit 1
;;
esac

exit 0

5、设置权限,设置开机启动

root@kali:~# chmod 755 /etc/init.d/vncboot
root@kali:~# update-rc.d vncboot defaults

如果想取消开机启动使用

root@kali:~# update-rc.d vncboot remove

6、reboot命令重启,启动VNC Viewer输入IP

启动成功
大功告成

You will require a password to access your desktops.

Password: 
Verify:   
Would you like to enter a view-only password (y/n)? n

New 'X' desktop is Kali:1

声明:初心|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA协议进行授权

转载:转载请注明原文链接 - Kali安装VNC


愿你勿忘初心,并从一而终