Wednesday, October 14, 2009

Mounting SMB Shares on Ubuntu

I have a 12+ year old Dell computer that's been faithfully chugging away in my basement as a file server running CentOS 4. Each user in the family has their own data directory on the server that is mounted on their Windows XP "My Documents" directory. Works great.

I've started thinking of switching over to Ubuntu as the primary OS for our family's use and so am experimenting using VirtualBox and a Ubuntu virtual machine. By the way, VirtualBox's seamless mode has a big "WOW" factor. It allows you to run a guest operating system, in this case, Ubuntu, and the Windows XP host system using, essentially, the same desktop. It's very cool and very useful. But I diverge.

As I mentioned, I have SAMBA shares sitting on the Dell file server and I want to mount each user's share onto their Ubuntu ~/Documents folder so they have exactly the same access as on the Window computers. I don't want to mess with NFS because then I have to worry about both NFS and SAMBA shares and I would prefer to have to deal with only one file sharing service.

This should work using SAMBA shares from any computer running any operating system. First, ensure you have the correct packages on your Ubuntu system. From a Ubuntu terminal, type:
sudo apt-get install smbfs smbclient
Before trying to mount the remote SMB share, securely store your Ubuntu login credentials so that the share will automount at boot. This is done by using your favorite text editor to edit the file /root/.credentials. Enter the following lines in the file, substituting the correct SMB username and SMB password (this example uses a SMB username of barney, a SMB password of betty.
Now make the credentials file root read-only by typing:
chmod 0600 /root/.credentials
Assuming the SAMBA server IP is, the remote SAMBA share is named barney, and barney's Ubuntu user id is 1000, enter the SMB share and mount point information in your /etc/fstab file as follows:
// /home/barney/Documents smbfs \
        auto,credentials=/root/.credentials,uid=1000,umask=000,user 0 0

To test, you can type:
sudo mount -a
or simply reboot.

Labels: , ,

ISO to Flash - Creating a Bootable Thumb Drive

If you have downloaded or created an ISO image (typically some Linux flavor) and you wish to copy the ISO onto flash media (thumb drive, CF, SD, etc.) so you can boot from it, it is very easy to do.
  1. Download the UNetbootin utility (
  2. Install and run Unetbootin
  3. Select the ISO you wish to copy
  4. Make sure you select the correct drive on which to install the ISO!!!
  5. Execute
  6. Boot from the flash drive