VNC over SSH, the idiots guide.

Since I rather like to have options, I’ve decided to augment my usual SSH /w option of X forwarding to the option of VNC as well.

Objective: connect to my netbooks X session using VNC, tunnelled over SSH.

Implementation:

Since my netbook runs a GNOME centric distribution, I’m using the “Remote Desktop” preferences program on “System -> Preferences”. If you’re like me and to damn lazy to hunt and peck, this just runs the program ‘vino-preferences’. On here it’s possible to setup VNC access to your desktop. In essence, it just runs vino when you login. There are loads of good and bad write ups on VNC server setup and 3 or 4 click setup is good enough for me.

My iptables rules pretty much block such things as incoming VNC requests, which is good because I don’t want the session exposed across the network interface. Pretty much all there is for accessing my netbook is the SSH port.

Now on another system, it’s possible to connect using SSH forwarding. This gains us both encryption for the VNC session and less port exposure; that is good for security.

PuTTY client setup:

  1. Load/create your session in PuTTY
  2. Go to SSH -> Tunnels
  3. Add a port forwards
    1. source port: 5900
    2. destination: localhost:5900
  4. Login to the system using PuTTY.
OpenSSH client setup:
  1. ssh -L 5900:localhost:5900 username@host
There are options for both if disabling the shell session and only running the forwarding is preferred (PuTTY: SSH->Don’t start a command at all; OpenSSH -> RTFM for -n, -N, and -f). 5900 is the default VNC port running off the server end (my netbook).
Now on the client machine, connecting any VNC client (e.g. TightVNC) to localhost should give the desktop session over at user@host; in this case, my X session on alice!
This is the shortest, sweetest, non-non-sense, you’re assumed to know how to RTFM if you want to know the facts, kind of write up that I’ve seen on doing this. Hmm, maybe it helps that I already know how to use SSH port forwarding with OpenSSH, hehehe.

One of the things that I’ve been working on over the weekend, is expanding my unix profile a bit. Pretty much, I have a universal ~/.sh directory that houses a profile for Bourne style shells, well, modern ones in the sense that functions are supported, which is like everything since 1980 or so.

An extension to this was pulling in my X session setup, since it is already in the same repository. This pretty much resulted in ~/init.sh becoming ~/.sh/rc.xinit. I pretty much use the same setup across machines, so it’s not a big problem; but startup programs based on where I am and what I’m doing, rather than normal session management.

So this poses a good question, short of resulting to some kind of “Session Chooser” on login, how to make it smart? Magic kind of smart! It’s not hard, so much as it is a bit sticky. The thing that varies the most is the network. Either:

  1. I have no network, and thus don’t need stuff like instant messaging.
  2. I’m at work, and have more use for stuff like monitoring
  3. I’m at home, and have more use for stuff like gmail and a broader selection of instant messaging services.
  4. I’m using my phone, and need to worry more about data usage than pre-loading applications.
So obviously, the idea is to react based on what network is in use. That is pretty easy by asking nmcli for the name of the network connection being used, once NetworkManager gets the ball running. Case statements ftw :-).
I have found one problem so far, which is that the instant messaging client that I use, has a command line interface to specify which accounts to sign in, but apparently, pidgins -l option doesn’t work as advertised by –help—or NAME != the name in accounts.xml. So perhaps I’ll just have to use separate clients for at work and not at work, or modify the XML file.

Every so often, life gives you a reason to be glad you learned something. Well, one for me was being stuck without working arrow keys on my server during early boot—and smiling because I knew vi well enough not to need any!

Today, I just got another lol. Setting up a bit of a server install here using some scavenged hardware. The keyboard I’m working with is both one of those annoying ones with the pipe (|) key missplaced in favour of a larger enter key—and having most of the keycaps in the wrong places! Well, unless they make a “<>PYF keyboard layout and the hardware see’s it as QWERTY :-D.

Where else but technology, could you have this much of a chuckle and life still be great? Haha!

Paste it!

A while back I was thinking of setting up a personal paste-bin, but obviously that means finding suitable software or writing it. In my case, I’d rather like one that is locked to me or restricted to logins I issue.

But it just occurred to me, that having sufficient access to the system, I can just use vim’s :TOhtml command to export a file as HTML, upload it to a designated area, and have the web server pick it up. Then use a cron-job on the server side to clean out files in that directory every now and then.

Yeah.

+1 for git in my book

Parsing this old blog post by Keith Packard, somehow makes me happy that I opted to follow the Git path rather than the Mercurial (hg) path when I left CVS behind. I also like the trailing comment xD.

That being said, git and hg are the only version control systems I really respect, above tar. Perforce and Darcs, I at least consider worth a closer look someday. Just haven’t had any excuse to leave Git on my own projects since the first date.

Yeah, I’m a lazy git alright.

Alice just proved her ROI lol. When I left work yesterday, I just unplugged her, closed the lid and slipped alice in my backpack. There it sat until getting to work just now—with 2:35 hours remaining on the battery!

This thing is energy efficient enough to take several times my laptops battery life, when under a normal load. Let it go into restrained sleep and it’s pretty darn long lived; I have Linux programmed to prefer using more power then is strictly necessary when on battery as well.

Using a custom window manager with Gnome / Ubuntu 11.04

I kinda expected that the upgrade to Natty Narwhal would be a bit bumpy, but it was pretty painless. Really all I use GNOME for is a way to get a system tray into my XMonad session with the least possible fuss. I also use a few GTK+Gnome oriented apps like evince and geeqie but have no real connexion to the old Gnome.

The only real bump that I have faced, is that overriding WINDOW_MANAGER and calling gnome-session is no longer enough to run GNOME with XMonad. Ubuntu 11.04 as of current update status, is overwriting this with compiz! Not even overriding the gconf key helps, it just gets reset to gnome-wm; which is what is *supposed* to be picking up the exported WINDOW_MANAGER variable from my X session file.

Solution? Found a helpful hint on the XMonad wiki. However rather than modify things at the system level (I am a BSD lover after all), I opted to instead setup a session file in $XDG_CONFIG_HOME/gnome-session/sessions/$LOGNAME.session. The default value for $XDG_CONFIG_HOME is ~/.config, $LOGNAME is another variable for $USER (your users’ login name).


[ terry@alice ]$ cat ~/.config/gnome-session/sessions/terry.session
[GNOME Session]
Name=Classic GNOME
Required=windowmanager;panel;filemanager;
Required-windowmanager=gnome-wm
Required-panel=gnome-panel
Required-filemanager=nautilus
DefaultApps=gnome-settings-daemon;
[ terry@alice ]$

Then updated my X session to run this with commit 3e92fc91040573ba40ac20ad75a594d6eeef60b6. And for good measure, I unset the gconf key.

Now everything worky 🙂

Well, it looks like alice is now fully operational: and my fingers are adjusting to her keyboard rapidly. Fortunately, I am finding myself more often hitting fn+key in place of ctrl+key on dixie, then I am on alice. Whew.

I’ve installed Ubuntu Netbook Edition, and set it up to behave as dixie has been used all these years: a workstation rather than a terminal. I don’t have time to fiddle further with making OpenBSD play nice with Windows 7 on this rig. This does pretty much net me all that I desire: a bourne shell, decent terminal multiplexer, XMonad, Chrome, Pidgin, Dropbox, and a system tray area. I can live with the (ugh) GNU and Ubuntu parts.

The only real difference between the Desktop and Netbook editions of Ubuntu, the former comes with a customised GNOME where as the latter comes with a custom GNOME shell called “Unity“. I have really got to say that Unity SUCKS!!!!!! I seriously cannot fathom anyone getting real work done with Unity because you’ll have to set it up to do anything more useful than launch Mozilla, it feels so useless, that I think I would trade GNU/Linux for MS-DOS 2/3, and old DOS really, really did suck. Once I found the GNOME shortcut for the run dialog didn’t work, I decided instantly it would have to Go.

But to be fair, Unity does do some Very Good Things, and I commend the engineers behind it for breaking away from the Windows norm, that every GUI app tends to follow. The focus on full-screening the apps also is a feature that I like. The whole dock/sidebar thing is also quite nice, if kind of restrictive. Not even KDE4 offered as much nice “Wow, this looks integrated” kind of warm and fuzzies.

But I don’t want to take hours to try and restructure the thing, nor do I want to constantly grep programs by their menu pretty names, or have to push a button for just about every darn thing. OK, I still live in a command prompt 75% or more of the time, so sue me.

How Alice got her name

(12:58:07 AM) Noles: Project Alice?
(12:58:09 AM) Me: sh.alice // I was typing in a terminal when this window popped up
(12:58:19 AM) Noles: hmm
(12:58:26 AM) Me: alice is the hostname of this netbook
(12:58:51 AM) Noles: it is like Project Alice in Residents Evil 😛
(12:59:24 AM) Me: Part a nod to ASUS (starts with A), Alice in Wonderland (I’m nuts), and to Project Alice because this [netbook] is cool like Alice 🙂
(12:59:35 AM) Noles: heh

This morning, my mother rather piqued my technical-goat, when she said she was “Tired of my excessive computer buying”. Which of course, is an instant sequence of hash look ups in my brain:

  1. SAL1600 (desktop) was bought with a long lost inheritance and strings attached (*groan*).
  2. Dixie (laptop) was bought by my sister-in-law, so I could get work done around my mother driving me nuts.
  3. Vectra (improvised server) is currently residing in a hodge-podge of parts:
    1. Some from a gutted-Dell my brother was throwing out.
    2. Some from an old Vectra Vli8 handed down from someone we used to work for, when he heard my mother was being a bitch about letting me dual boot her (then “family”) computer.
Alice here, is the first computer that I’ve ever bought myself, not to mention it’s the cheapest computer I’ve ever had, lol. So, what the fudge is so “Excessive” about buying one computer, which probably cost me 25% or less than what hers cost? *Shrugs*
People are stupid.