Setting up Samba on Ubuntu Server 8.04

It’s been a few years since I last set up a Samba system, and the process is still as painful as ever. A lot of this pain comes from multiple authentication systems, which all have to be in sync for things to work.

I started out with the link here:
http://ubuntuforums.org/showthread.php?t=202605
and pretty much ignored all of it. In the end, I took the default 8.04.3 /etc/samba/smb.conf, and made the following changes:

  • Set the workgroup in the global stanza
  • Added stanzas like the following:

    [music]
        path = /music
        browseable = yes
        read only = no
        guest ok = no
        create mask = 0644
        directory mask = 0755
        force user = andrew
        force group = sambashare
    

Note that I’m using user permissions, not share permissions. So I had to add and enable the Samba user:

sudo smbpasswd -L -a andrew
sudo smbpasswd -L -e andrew

Originally, I had force group = andrew. When I tried to mount using this option, I’d see:

$ sudo mount -a
mount error(5): Input/output error
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

What lovely error messages. I found a semi-useful diagnostic tool, smbclient:

smbclient //server/music -U andrew
Enter andrew's password: 
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.28a]
tree connect failed: NT_STATUS_NO_SUCH_GROUP

I did have an andrew group, but the user andrew wasn’t in that group according to /etc/group, so I switched to sambashare (which does have andrew as a member). Then it worked. Just adding andrew as a member of the group andrew in /etc/group was not sufficient. No idea why, but probably Samba has some concept of groups that needs to be set up too.

Next, I tried to connect again:

smbclient //server/music -U andrew
Enter andrew's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.28a]
tree connect failed: NT_STATUS_BAD_NETWORK_NAME 

This let me search on NT_STATUS_BAD_NETWORK_NAME and discover that, gee, that means permissons are bad for the directory that is being shared. Nothing better than helpful error messages.

A final /etc/init.d/samba restart and I could connect.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: