My ongoing experiences with Ubuntu, and later Mythbuntu, as a media center with MythTV. I'm also using the system for a virtual machine server, a mediawiki server and a general all around home infrastructure base.

Saturday, January 27, 2007

Ubuntu 6.10 Samba File Sharing

I'm setting up Ubuntu 6.10 (Edgy) on a new PC for use as a general file and MP3 server for a couple Windows XP and MacOS laptops we have. I'm doing this on a Dell n series Optiplex 740, which I mention beause you can order one without windows pre-installed.

As I do this process, I thought I'd share my experiences (and record them so I can remember them) since although Ubuntu is nice, I'm still having to work through a number of non-trivial steps. Hence I created this blog as an experiment to do so. We'll see how it goes...

I'm fairly well versed in Unix and Windows. I'm assuming the reader has some experise, so I'm not going into every little detail, just the stuff I though was non obvious. I strongly recommend the Ubuntu Guide for more information if you're just getting going with Ubuntu.

The first thing I wanted to get going was Samba file sharing so that the various laptops could access server's disk. Starting up Samba turned out to be easy, I selected System/Preferences/Shared Folders and the system informed me I didn't have Samba installed and asked me if I wanted it installed. I replied affirmatively and the install went smooth as silk. I clicked on my home directory (eventually I plan on exporting a number of things, but this works to start with) and Properties. I selected "Windows networks (SMB)" and gave it a share name of my choosing. I unchecked Read only, because I wanted to be able to both read and write from the various laptops.

Back in Shared Folders/General Properties I have MSHOME for a Domain/Workgroup (this seems to be some Windows default name). WINS server was unchecked and the WINS server text field was blank.

Click Close and all seemed well. I was able to see the share from my various laptops, but not able to authenticate to actually mount it. Turns out the way Samba is configured by default, you have to add users to the Samba user database, e.g. launch Applications/Terminal and type:

sudo smbpasswd -L -a username
sudo smbpasswd -L -e username

Replace username with a username of your choosing. It needs to be the same for both commands. In my case the chosen username matched my Unix/Ubuntu username - I think it's ok for the default Samba configure if it doesn't but I haven't tested it yet (see my subsequent notes about smb.conf).

After being asked for the system password, you'll be asked to create a password for the Samba username (this is in response to the first command, the second command just activates the account and doesn't prompt for anything). BTW, I usually don't type sudo for each command, I launch a root shell with "sudo -s", I suspect as I go along I may forget this and leave off sudo.

Then using that username and password I was able to mount the filesystem on my various laptops.

BTW, looking at the /etc/samba/smb.conf file it looks like there are various options to try and keep the Samba and Unix/Ubuntu passwords in sync, including options to force Sambe usernames to have a corresponding Unix username (which seems to be off by default). I haven't played with any at this time and am using the default smb.conf file.
Post a Comment