Filed under: Technical References
Posted: March 7, 2009
First, login to the shell server via a terminal program like PuTTY.
Now at the command line type:
vncserver [optional parameters] -geometry (specifies the screen size (default 1024×768)) -depth (specifies the color depth) -compatiblekbd (makes VNCviewer pass alt keypress to server)
Execute man vncserver at your terminal to view all options.
If this is the first time running vncserver then the server will prompt you to create a new password, type the password you choose twice and then hit n when asked if you want to create view-only password.
If this is the first time running vncserver then the server will prompt you to create a new password, type the password you choose twice and then hit n when asked if you want to create view-only password.
After you’re returned to the command-line you’ll notice that the server outputted a line that reads something like, New ‘X’ desktop is london:2
What that is telling you is that you have a desktop spawned on london with desktop number :2.
Now download the TightVNC Viewer.
Download and launch that application, when prompted for the servername+desktop number type in the shell server name followed by a ‘:’ and then the desktop number you were given (in this example it would be: “london.cs.uri.edu:2″). Enter your password and window will open with a fully functional remote desktop to the shell server.
The following is a sample ssh session showing how to setup the server the first time:
edensm@london edensm $ vncserver -geometry 1000×700 -depth 16 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 london:2 Creating default startup script /home/ugrad/major/edensm/.vnc/xstartup Starting applications specified in /home/ugrad/major/edensm/.vnc/xstartup Log file is /home/ugrad/major/edensm/.vnc/london:2.log edensm@london edensm $
Setting vncserver to Launch a Different Window Manager
You might notice that the desktop looks a bit drab. None of the bells and whistles you’re used to with a modern operating system.
To fix this switch back to your terminal client. Run a ls -at to view all files (including hidden ones) based upon timestamp, newest first. You’ll notice a .vnc directory near the top. vncserver created that directory the first time you invoked the command. Change into that directory via cd .vnc. Running a ls inside there will reveal a file named xstartup. Modify that file with nano -w xstartup. Change the line that reads twm & to something like startkde &. Then kill off your old desktop by typing vncserver -kill :yourdesktopnumber (in my case it was “:2″). Now respawn vncserver by executing, vncserver -geometry 1000×700 -depth 16
You now have a fully functional KDE desktop running on our shell server.
Important Notes
There are a couple of things to note. First, ALWAYS MAKE SURE YOU KILL OFF YOUR SERVER IF YOU’RE NO LONGER USING IT. You can do this by executing vncserver -kill :desktopnumber, where :desktopnumber is the number assigned to your desktop. If you can’t remember your desktop number then try executing the command ps ux | grep Xvnc. You should see a line listing a process named Xvnc :yourdesktopnumber. Now that you know your desktopnumber kill it with vncserver. Second, your desktop will run until the machine is restarted or the system administrators kill it due to resource constraints (or if you’ve launched numerous desktops without killing them). Its not likely the machine will be restarted unless the core kernel needs to be updated so you can be assured that your desktop will most likely be open for a long time (although, as always, you should save your work often!). This does take computing resources away from your fellow students. Third, you can go anywhere in the world and access your desktop provided that you have a vncviewer. You can also launch the vncviewer from multiple locations and witness the modification of one location impacting the viewer on the other computer. Try it out.
Good luck with your remote desktop.
