Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Saturday, 5 December 2015

TightVNC Client, SSH, TightVNC Server


I have to make some notes on this before I forget. This post attempts to be that note.

Perhaps you have a Virtual Private Server (VPS) or just a server out there somewhere in the ether. You want to share or view a remote desktop, but you want a secure tunnel for those bits to travel down. In this scenario your server is a linux (some variant, lets not start a religious war about it) and you installed tightvncserver. In addition you have SSH running. On your client, lets say windows, you have putty and tightvncserver.

For those with OCD here is a recap:

Server:
1. TightVNCServer.
2. SSH

Client:
3. Putty
4. TightVNC Viewer.

The only note I will make about tightvncserver is that you should have it only listen on loopback (127.0.0.1) since this typically is not a service you want exposed. We use '-nolisten tcp' to ensure we do not allow external tcp connections outside of our SSH tunnel.

In /etc/init.d/tightvncserver you would have a start line such as:

su $USER -c '/usr/bin/tightvncserver -nolisten tcp -localhost :1'

On the client follow the instructions at: http://www.penguintutor.com/linux/tightvnc

In a nutshell, you: 

1. In Putty create a session  with a hostname (or IP) and port of the SSH service running on your remote linux box.
2. Select Connection->SSH->Tunnels and enter source port 5901 and destination of localhost:5901
3. Back to session selection in the left pane and type a name for saved sessions and click save.
4. Then Click open for the session and a SSH window to your target should open where you can login.
5. Once logged in there is now a tunnel in place.
6. Run TightVNCViewer and connect to 'localhost:1' 

Friday, 5 December 2014

More Virtualbox, headless, Screen resolution

So my main monitor has a 16:9 ratio and a 1920x1080 resolution. The resolutions I have on my lubuntu 14.10 VM usually means they are two large and I have to scroll within  the VNC window or to small that I need a stronger pair of glass. Where is 1920x1080.

So here are the steps I used to create the resolution.

$ sudo xrandr --newmode "1920x1080"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
$ sudo xrandr
Screen 0: minimum 64 x 64, current 1440 x 1050, maximum 16384 x 16384
VBOX0 connected 1440x1050+0+0 0mm x 0mm
   1440x1050      60.0*+   60.0*
   1600x1200      60.0 
   1280x960       60.0 
   1024x768       60.0 
   800x600        60.0 
   640x480        60.0 
  1920x1080 (0x19e)  173.0MHz
        h: width  1920 start 2048 end 2248 total 2576 skew    0 clock   67.2KHz
        v: height 1080 start 1083 end 1088 total 1120           clock   60.0Hz
$ sudo xrandr --addmode VBOX0 1920x1080
$ sudo xrandr --output VBOX0 --mode 1920x1080



References:
http://askubuntu.com/questions/436558/external-display-resolution-vga-output
http://www.techsfo.com/blog/2013/07/1920x1080-ubuntu-vmware/

Thursday, 20 November 2014

Lubuntu 14.10 Virtualbox VNC

I am playing around with Lubuntu 14.10 as a guest OS in virtualbox. I like Ubuntu but wanted to try something lighter. But of course when I first run Lubuntu after install  I am limited to a crap screen resolution. This is also headless which no doubt limits the OS to decide a minimal default. Here is more or less what I ended up doing.

1. apt-get install dkms
2. Install guest addition. In this case I had the vm guest mount the iso directly. Then I ran VBoxLinuxAdditions.run from the /media directory mounted.
3. I was still having issues at this stage until I found this post. http://askubuntu.com/a/450626/350726

  • xdiagnose and ticked all 3 debug options
  • restart
  • additional drivers and reticked the "using x86 virtualisation solution guest adition module and applied the changes.
  • restart

Now it can dynamically resize the resolution. Note that the maximum size of the guest window in the host affects the resolution that a VNC client to the guest can see.

Tuesday, 11 March 2014

Ubuntu 12.04 + virtualbox

So a linux VM running in virtualbox crashed. Well, they all crashed.

But when I restarted the server I was hit with a couple of error. The core one was this:

Kernel driver not installed (rc=-1908)
The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing
'/etc/init.d/vboxdrv setup'
as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.
Scary. But, google is my friend. I found this post in an Ubuntu forum:

http://askubuntu.com/questions/205154/virtualbox-etc-init-d-vboxdrv-setup-issue

It was an excellent review of the problem. The steps that worked for me were:

sudo apt-get install linux-headers-`uname -r`
 
My headers were up to date so this was not that important, but should be performed regardless.
 
Then reconfigure dkms and load module:

sudo dpkg-reconfigure virtualbox-dkms  
sudo modprobe vboxdrv
 
This  got me farther but then received another network error which was solved with:
 
sudo modprobe vboxnetflt
 
And now we seem to be back in business.