0

I currently have Ubuntu Desktop installed on my laptop. I also have Ubuntu Server installed on my media server (headless) that I am in the process of building.

Goal: I would like to be able to remote into my server from my laptop and be given a GUI. I want a GUI because it will make it easier to place new media files from my external HDD to different folders on the server on a regular basis.(Drag and Drop)

I have tried to find a guide on real vnc or something similar but i have no clue what to do.

Can anyone give me a guide on how to reach my goal?

1
3

You can use vnc for gui access to server.

Install the VNC-server

sudo apt-get install vnc4server

Please make sure that you are using only vnc-server & no other VNC-server are installed as this could give errors in future mostly that clipboard sharing between the host Ubuntu Server & vnc-client machine. You can check it as follows:

xxx@yyy ~ $ sudo dpkg -l | grep vnc
ii  vnc4server                                            4.1.1+xorg4.3.0-37ubuntu5                           amd64        Virtual network computing server software
xxx@yyy ~ $

Please uninstall if tightvnc or anything similar installed. Adding VNC user

In my case I am using user=sssss it will differ in your case. You can use any username for the same.

adduser sssss

xxx@server1:~$ sudo adduser sssss
Adding user `sssss' ...
Adding new group `sssss' (1001) ...
Adding new group `sssss' (1001) ...
Adding new user `sssss' (1001) with group `sssss' ...
Creating home directory `/home/sssss' ...
Copying files from `/etc/skel' ...

Enter new UNIX password: <--yourpassword
Retype new UNIX password: <--yourpassword
passwd: password updated successfully
Changing the user information for sssss
Enter the new value, or press ENTER for the default
    Full Name []: <--ENTER
    Room Number []: <--ENTER 
    Work Phone []:<--ENTER 
    Home Phone []:<--ENTER
    Other []:<--ENTER 

  Is the information correct? [Y/n]<--ENTER

Start the vncserver with the user, for this use:

su - srijan
vncserver

It will see:

    sssss@server1:~$ vncserver

You will require a password to access your desktops.

Password:<--Put your VNC password 
Verify:<--Put your VNC password
Password too long - only the first 8 characters will be used
xauth:  file /home/sssss/.Xauthority does not exist

New 'server1:1 (sssss)' desktop is server1:1

Creating default startup script /home/sssss/.vnc/xstartup
Starting applications specified in /home/sssss/.vnc/xstartup
Log file is /home/sssss/.vnc/server1:1.log

    sssss@server1:~$

Make backup of the original file & then make the configuration

cp ~/.vnc/xstartup ~/.vnc/xstartup.bak > ~/.vnc/xstartup
vi ~/.vnc/xstartup

#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

Make the startup script for the vncserver

sudo vi /etc/init.d/vncserver


#!/bin/bash

unset VNCSERVERARGS
VNCSERVERS=""
[ -f /etc/vncserver/vncservers.conf ] && . /etc/vncserver/vncservers.conf
prog=$"VNC server"
start() {
 . /lib/lsb/init-functions
 REQ_USER=$2
 echo -n $"Starting $prog: "
 ulimit -S -c 0 >/dev/null 2>&1
 RETVAL=0
 for display in ${VNCSERVERS}
 do
 export USER="${display##*:}"
 if test -z "${REQ_USER}" -o "${REQ_USER}" == ${USER} ; then
 echo -n "${display} "
 unset BASH_ENV ENV
 DISP="${display%%:*}"
 export VNCUSERARGS="${VNCSERVERARGS[${DISP}]}"
 su ${USER} -c "cd ~${USER} && [ -f .vnc/passwd ] && vncserver :${DISP} ${VNCUSERARGS}"
 fi
 done
}
stop() {
 . /lib/lsb/init-functions
 REQ_USER=$2
 echo -n $"Shutting down VNCServer: "
 for display in ${VNCSERVERS}
 do
 export USER="${display##*:}"
 if test -z "${REQ_USER}" -o "${REQ_USER}" == ${USER} ; then
 echo -n "${display} "
 unset BASH_ENV ENV
 export USER="${display##*:}"
 su ${USER} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1
 fi
 done
 echo -e "\n"
 echo "VNCServer Stopped"
}
case "$1" in
start)
start $@
;;
stop)
stop $@
;;
restart|reload)
stop $@
sleep 3
start $@
;;
condrestart)
if [ -f /var/lock/subsys/vncserver ]; then
stop $@
sleep 3
start $@
fi
;;
status)
status Xvnc
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac

Make it executable:

chmod +x /etc/init.d/vncserver

Make the configuration file for the vncserver by creating file as follows:

mkdir -p /etc/vncserver
vi /etc/vncserver/vncservers.conf

Give the entries like this.

VNCSERVERS="1:sssss"
VNCSERVERARGS[1]="-geometry 1024x768"

Add it into boot startups:

update-rc.d vncserver defaults 99

xxx@server1:~$ sudo update-rc.d vncserver defaults 99
 Adding system startup for /etc/init.d/vncserver ...
   /etc/rc0.d/K99vncserver -> ../init.d/vncserver
   /etc/rc1.d/K99vncserver -> ../init.d/vncserver
   /etc/rc6.d/K99vncserver -> ../init.d/vncserver
   /etc/rc2.d/S99vncserver -> ../init.d/vncserver
   /etc/rc3.d/S99vncserver -> ../init.d/vncserver
   /etc/rc4.d/S99vncserver -> ../init.d/vncserver
   /etc/rc5.d/S99vncserver -> ../init.d/vncserver
xxx@server1:~$

Reboot the machine.

To access server you can use any VNC/Clients Application.

1
  • excellent explination! Sorry its been a month since you answered it lol but really good answer thanks again.
    – Brian
    May 17 '15 at 7:58
0

To drag and drop files between your desktop machine and a server, there is no need to install a GUI on your server, let alone VNC into it.

In Nautilus, click "Connect to Server". Then for the server address type sftp://servername/path. If the target folders are Samba shares, you could also use smb://servername/sharename.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.