Samba, CIFS, and Ubuntu Linux Server

confusedI run a couple of servers at my house. One of them is my fileserver, and it uses Samba to do simple Windows filesharing. My 20 GB digital photos partition was full, so I got a 120 GB harddrive and setup an Ubuntu Server 6.06 based fileserver. I transferred the files using rsync, and installed samba on the new server. I set the UID=nobody and the GID=users on all the files. I set the group id inheritance bit on the Linux directories, and removed the world/other rights.

# files are read/write for group and owner
find $1 -type f -exec chmod 660 {} \;
# directories are read/write/cd-able/inherited GID
find $1 -type d -exec chmod 02770 {} \;
# make these files owner=nobody, group=users
chown -R nobody:users $1

I setup Samba to mimic the Linux file system, and forced some settings when new files and directories are created. Here is my smb.conf entry:

comment = Common Data Directory
path = /home/skarg/data
force user = nobody
force group = users
read only = No
create mask = 0660
force create mode = 0660
directory mask = 02770
force directory mode = 02770
inherit permissions = Yes
guest ok = Yes

Normally, you can add a CIFS mount in /etc/fstab, and specify the UID and GID that the linux filesystem will use. But the cifs filesystem mount wasn’t using the UID that I specified, and that’s when I discovered that Samba now has unix extensions, which cause the problem that I was seeing. Unix extensions can be turned off in samba by adding the following line to /etc/samba/smb.conf:

unix extensions = no

I also turned off the extensions on the workstation:

echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled

I was trying to get one of the other Ubuntu Server based linux servers to mount the Windows share, but kept getting an error message:

CIFS VFS: cifs_mount failed w/return code = -22

Google found the mailing list where someone had that problem, and the solution was to add the mount.cifs command, since the kernel didn’t know the domain name to IP lookup. I tried to use the advanced package tool to find it:

apt-cache search mount.cifs

Nothing. I tried several other solutions, but they didn’t work. I Googled again, and found another post about mount.cifs, which made me think, and I searched the server for mount.cifs using the locate command. mount.cifs wasn’t there! Finally I went to the Ubuntu packages site, and did a search in the contents of each package. mount.cifs is part of the smbfs package. I initially didn’t want to install the smbfs package since smbfs is depracated in favor of cifs.

sudo apt-get install smbfs

Now the server has the CIFS filesystem mounted. However, it is not perfect yet. Stay tuned!

About skarg

I write software for a living. So, I dedicated some web space for some stuff that I have worked on. I mostly write embedded C for PC based controllers, but I have dabbled in a few other areas as well.
This entry was posted in applications, Linux. Bookmark the permalink.

One Response to Samba, CIFS, and Ubuntu Linux Server

  1. WzrdOfOost says:

    I am working on my first linux-server. Although I`m still a noob this was usefull for me.

Leave a Reply

Your email address will not be published. Required fields are marked *