Skip to content

Instantly share code, notes, and snippets.

@itsuwari
Created May 28, 2017 18:10
Show Gist options
  • Save itsuwari/216b9a7244032c5712cd2414b2b4899c to your computer and use it in GitHub Desktop.
Save itsuwari/216b9a7244032c5712cd2414b2b4899c to your computer and use it in GitHub Desktop.
apt-get install xfce4 xfce4-goodies gnome-icon-theme tightvncserver -y
# adduser vnc
Give a password to your new user. You can skip all other questions by simply pressing ENTER.
Install sudo by executing this command:
apt-get install sudo
Add your new vnc user to the sudo group, which will give permissions to that user to execute root commands.
gpasswd -a vnc sudo
Let's switch to the vnc user:
su - vnc
Step 3 — Starting and Stopping Your VNC Server
As our newly created vnc user, we can start VNC Server and test our connection.
Start VNC Server:
vncserver
As it is your first time running the server, you will be asked to set a password that clients will use to connect. Keep this password in mind for later! You can also set a view-only password, which will allow users to see the screen but not interact with it. Passwords should be 6-8 characters.
You will get a notice about your display number when the server is started.
Output
xauth: file /home/vnc/.Xauthority does not exist
New 'X' desktop is vnc:1
Creating default startup script /home/vnc/.vnc/xstartup
Starting applications specified in /home/vnc/.vnc/xstartup
Log file is /home/vnc/.vnc/vnc:1.log
By default, VNC connections are served on ports starting at 5901 for the first display. Your second display will be served on port 5902, etc.
Don't stop the server now, but we're including the stop command for reference.
Use this command to stop your VNC server on Display 1 (and port 5901):
vncserver -kill :1
:1 is the display number you want to kill.
You can start VNC Server manually when you want to connect again. We'll create a service for VNC Server in a later step.
Step 4 — Connecting from a VNC Client
You can now connect to your VNC server. Open your local VNC client, which will vary depending on your operating system.
On Windows, you can use UltraVNC here.
On OS X, you can use the built-in Screen Sharing app or access this app through Safari. In Safari, you can enter vnc://yourserverip:5901
For your VNC Server address, enter yourserverip:5901 and use the password you just set for your VNC connection.
You can select the Use default config button on the XFCE welcome screen to get started easily:
Xubuntu Welcome Screen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment