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
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!
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:
- Add the following to
/etc/gdm/Init/Defaultbeforesysmodmap=/etc/X11/Xmodmap:#Start the Synergy client for KVM switching SYNERGYC=`gdmwhich synergyc` if [ x$SYNERGYC != x ] ; then $SYNERGYC servername fi
- 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.
Filed under: Tools, Ubuntu | Tags: note to self sharing files mount smbfs
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:
- On Box2, apt-get install smbfs
- On Box2, create a mount point (e.g. /media/Downloads) and edit
/etc/fstab. - Add the line
//Box1/Downloads /media/Downloads smbfs credentials=/etc/samba/.cred-file,gid=users,dmask=775,uid=USERNAME 0 0 - Create
/etc/samba/.cred-fileand add the lines:username=USERNAME
password=PASSWORDobviously replacing with the correct values.
sudo mount -a
You should be sorted.
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?
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
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.
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.
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:
- Generate a new password in Base64.
- Edit the
/home/<userhomedir>/.gconf/desktop/gnome/remote_access/%gconf.xml file - Paste your new comment at the line that reads
<entry name="vnc_password"... - Done.
Sorted.
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):
- Buy a new hard drive
- Install Ubuntu fresh
apt-get install make gcc g++ ddrescuewget http://www.kalysto.org/pkg/dd_rhelp-0.1.2.tar.gztar xzvf dd_rhelp-0.1.2.tar.gzcd dd_rhelp-0.1.2./configuremakemake installcd ..cp dd_rhelp /bincd /bin- Plug in the dying hard drive and mount it (for arguments sake /dev/hdd4)
- Mount the new drive (for arguments sake /dev/hda3) with a lot of space
dd_rhelp /dev/hdd4 /dev/hda3/backup.img- This will take ages (i.e. 10 hours for my drive) as it copies the entire partition (including empty space) to that img file.
- When it's done, poweroff and unplug the dead drive, then reboot and run
fsck /dev/hda3/backup.imgto clean it of errors. - Mount the img file by using something like
/mnt/hda3/backup.img /mnt/recover ext3 defaults 0 0 - If everything has worked, your recovered files should be in the lost+found folder in that drive.
- Get down on your knees and thank God! Then go backup.