forked from nongkrek/Riset-IoT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vnc-viewer-ubuntu-18.04
79 lines (65 loc) · 2.81 KB
/
vnc-viewer-ubuntu-18.04
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
install vnc and configure on ubuntu mate 18.04
Step 1 — Installing the Desktop Environment and VNC Server
- sudo apt update
- sudo apt install xfce4 xfce4-goodies
- sudo apt install tightvncserver
- vncserver
You'll be prompted to enter and verify a password to access your machine remotely:
Output
You will require a password to access your desktops.
Password:
Verify:
Output
Would you like to enter a view-only password (y/n)? n
xauth: file /home/sammy/.Xauthority does not exist
New 'X' desktop is your_hostname:1
Creating default startup script /home/sammy/.vnc/xstartup
Starting applications specified in /home/sammy/.vnc/xstartup
Log file is /home/sammy/.vnc/your_hostname:1.log
Step 2 — Configuring the VNC Server
- vncserver -kill :1
Output Killing Xtightvnc process ID 17648
- mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
- nano ~/.vnc/xstartup
#masukkan script dibawah ini didalam file ~/.vnc/xstartup
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
- sudo chmod +x ~/.vnc/xstartup
- vncserver
Output
New 'X' desktop is your_hostname:1
Starting applications specified in /home/sammy/.vnc/xstartup
Log file is /home/sammy/.vnc/your_hostname:1.log
Step 3 — Connecting the VNC Desktop Securely
- ssh -L 5901:127.0.0.1:5901 -C -N -l your_name your_server_ip
- If you are using a graphical SSH client, like PuTTY, use your_server_ip as the connection IP, and set localhost:5901 as a new forwarded port in the program's SSH tunnel settings.
Once the tunnel is running, use a VNC client to connect to localhost:5901. You'll be prompted to authenticate using the password you set in Step 1.
Step 4 — Running VNC as a System Service
- sudo nano /etc/systemd/system/vncserver@.service
#masukkan script dibawah ini /etc/systemd/system/vncserver@.service
[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target
[Service]
Type=forking
User=root
WorkingDirectory=/root
PIDFile=/root/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
- sudo systemctl daemon-reload
- sudo systemctl enable vncserver@1.service
- vncserver -kill :1
- sudo systemctl start vncserver@1
- sudo systemctl status vncserver@1
Output
● vncserver@1.service - Start TightVNC server at startup
Loaded: loaded (/etc/systemd/system/vncserver@.service; indirect; vendor preset: enabled)
Active: active (running) since Mon 2018-07-09 18:13:53 UTC; 2min 14s ago
Process: 22322 ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :1 (code=exited, status=0/SUCCESS)
Process: 22316 ExecStartPre=/usr/bin/vncserver -kill :1 > /dev/null 2>&1 (code=exited, status=0/SUCCESS)
Main PID: 22330 (Xtightvnc)