The Crane Has Landed


Great link for command line SAMBA
July 12, 2009, 9:06 am
Filed under: Development, Tips, Tools, Ubuntu

I’m just discovering the usefulness of smbclient and this link has a great summary of the commands you can fire through this tool from the terminal.

Probably the most common one I need to do is to use the tarmode to copy whole folders down, like so:


tarmode
lcd /tmp #this switches the local directory
recurse
prompt
mget pdf995/ #this recurses and tars the pdf995 remote directory and puts it in /tmp on the client



Check multiple browsers
April 9, 2009, 2:24 pm
Filed under: Development, Tools

As one who does web development from time to time, Xenocode’s website is an absolute gem of a find! The site allows you to virtualise and access all the major web browsers to check your code – for free! Brilliant! :)



Synergy KVM
June 2, 2008, 2:34 pm
Filed under: Tools, Ubuntu

Another sweet find!  Synergy is a virtual KVM.  Basically, what this means is that you can control more than one machine…very useful when you have two machines side by side with separate monitors.  The uber-sweet nature of the sweetness is that it is open source and multi platform, so I can jump between my Windows laptop and Ubuntu server with ease!  Sweeeeet!

To do this, download the synergy source from the link above and follow the instructions on the page.  I have it set so my laptop (primary machine) is the server, so I followed the simply Windows instructions to get that working.  For the Ubuntu clients, the tricky bit was to get it so that synergy automatically starts at the login screen.  To do this:

  1. Add the following to /etc/gdm/Init/Default before sysmodmap=/etc/X11/Xmodmap:
    #Start the Synergy client for KVM switching
    	SYNERGYC=`gdmwhich synergyc`
    	if [ x$SYNERGYC != x ] ; then
    			$SYNERGYC servername
    	fi
    
  2. Add the same to PreSession/Default before the setting of the background color.

That pretty much does it I think.  NB: Hardy Heron seems to have some performance issues and you may need to manually run it as root instead.



Mounting over Samba (SMBFS)
February 24, 2008, 1:24 pm
Filed under: Tools, Ubuntu | Tags:

If you want to get one Ubuntu box talking to another and have the shares mounted, then this is what you do.

Say that Box1 has a Downloads folder that you’d like to have available on Box2. Follow these steps:

  1. On Box2, apt-get install smbfs
  2. On Box2, create a mount point (e.g. /media/Downloads) and edit /etc/fstab.
  3. Add the line //Box1/Downloads /media/Downloads smbfs credentials=/etc/samba/.cred-file,gid=users,dmask=775,uid=USERNAME 0 0
  4. Create /etc/samba/.cred-file and add the lines:

    username=USERNAME
    password=PASSWORD

    obviously replacing with the correct values.

  5. sudo mount -a

You should be sorted.



Installing a driver using ndiswrapper
January 14, 2008, 6:19 pm
Filed under: Tools, Ubuntu | Tags:

Face it – at the time of writing this, Ubuntu still has rubbish support for wireless drivers. Fortunately, you can use ndiswrapper to get it to wrap the Windows driver. I’m too lazy to repost it all, but here’s the instructions.

Maybe one day I can delete this post? ;)



From FTP to disk using Midnight Commander
December 22, 2007, 1:21 pm
Filed under: Tools, Ubuntu

When using Midnight Commander (MC) in Linux, you can copy files and folders to and from an FTP account using FTPFS. To do this, in MC, connect to the share by using:

cd /#ftp:username:password@server



Cloning a VDI disk
November 26, 2007, 8:04 pm
Filed under: Tools | Tags:

When using VirtualBox, if you want to copy the virtual disk image (VDI), use the following command:

VBoxManage clonevdi source target

Simple as.  Except, it’s important to note that this will only clone the base image – i.e. without snapshots!  If you want to clone the current state image, you’ll have to remove the snapshots to collapse them down into one image.



Tunnelling X output over SSH
November 14, 2007, 8:58 pm
Filed under: Tools, Ubuntu, Uncategorized

This is a good one.  Since VNC is pretty slow over the internets, it may be better to have the NX nomachine server setup on your Ubuntu box, and then tunnel that X output directly over SSH.  To do that, make sure you have the checkbox set in the NX client to push all data over SSL, and then tunnel port 22 on the server in question to 127.0.0.1.  Then connect to 127.0.0.1 and you should be in with a grin.



Resetting the default VNC server password from the command line
November 14, 2007, 8:55 pm
Filed under: Tools, Ubuntu, Uncategorized

So, it turns out that Ubuntu 7.10 (Gutsy) comes with VNC installed by default. If, however, you happen to be tunnelling in through SSH and you want to reset the password, there’s no command line command to do that directly. So, you need to do the following:

  1. Generate a new password in Base64.
  2. Edit the /home/<userhomedir>/.gconf/desktop/gnome/remote_access/%gconf.xml file
  3. Paste your new comment at the line that reads <entry name="vnc_password"...
  4. Done.

Sorted.



Recovering a dead hard drive in Ubuntu
November 13, 2007, 9:51 pm
Filed under: Tools, Ubuntu | Tags:

So, as my previous post outlined, I came to the realisation that this blog would be a good idea right about the time I started to hunt through the internets to fix my broken hard drive.

A recap – I booted up my Ubuntu (7.10 Gutsy Gibbo) box, only to have it come up with a series of errors as fsck tried to locate bad inodes. What appeared to have happened is that there were one or more bad sectors on my primary boot disk (a 200GB Seagate Barracuda) – sectors that happened to be right where Linux needed them to boot.

Booting into Ubuntu with a live CD only proved heartbreaking – the only other bad sectors on that disk were my photos! Thousands of un-backed up images. Let’s just say some choice phrases were used at this point.

A number of remedies were attempted, but the one that worked in the end was to take an image of the whole partition and use ddrescue and dd_rhelp. Basically, this is what I can remember (I’ll try to be more complete on future posts):

  1. Buy a new hard drive
  2. Install Ubuntu fresh
  3. apt-get install make gcc g++ ddrescue
  4. wget http://www.kalysto.org/pkg/dd_rhelp-0.1.2.tar.gz
  5. tar xzvf dd_rhelp-0.1.2.tar.gz
  6. cd dd_rhelp-0.1.2
  7. ./configure
  8. make
  9. make install
  10. cd ..
  11. cp dd_rhelp /bin
  12. cd /bin
  13. Plug in the dying hard drive and mount it (for arguments sake /dev/hdd4)
  14. Mount the new drive (for arguments sake /dev/hda3) with a lot of space
  15. dd_rhelp /dev/hdd4 /dev/hda3/backup.img
  16. This will take ages (i.e. 10 hours for my drive) as it copies the entire partition (including empty space) to that img file.
  17. When it's done, poweroff and unplug the dead drive, then reboot and run fsck /dev/hda3/backup.img to clean it of errors.
  18. Mount the img file by using something like /mnt/hda3/backup.img /mnt/recover ext3 defaults 0 0
  19. If everything has worked, your recovered files should be in the lost+found folder in that drive.
  20. Get down on your knees and thank God! Then go backup.