Common Samba Issues in RedHat Based Distributions

Judging from what I see on Fedora forums I've put together this quick checklist. (It's also laziness---this way, if I see a samba problem listed on the forums, I can point the OP, Original Poster, to this page.) I will be saying Fedora, but much of this also applies to CentOS. Most of the commands here will have to be run as root or with root privilege. If you get a command not found, it means you didn't get root's $PATH. See my page about that.

Firewall issues

Unless you've chosen to allow it during installation, the default Fedora firewall blocks samba. One way to test this is to temporarily disable iptables.
/etc/init.d/iptables stop

Now try again. If it works, then the fault was with iptables. This can usually be fixed with
iptables -I INPUT -s 0/0 -p tcp --syn -d 0/0 --dport 137:139 -j ACCEPT
iptables -I INPUT -s 0/0 -p udp  -d 0/0 --dport 137:139 -j ACCEPT

The -I INPUT means we're inserting these lines into the input chain. (If you use -A as in add, it goes to the end of the rules. As iptables stops processing a packet when it gets a match, this means the packets might be rejected before ever getting to the rules you've added. So, we use -I to put the rules before any rejection rules.

The -s 0/0 means from anywhere--you might just want it from your local network. If you had the typical 192.168.1.0/24 type network you'd change the -s to 192.168.1.0/24. The -p is for protocol, samba needs both UDP and TCP. The --syn is for syn flags on TCP packets, the --dport is for destination ports, the -j for jump and ACCEPT is, errm, to accept it. There are various GUI or curses based tools as well, like system-config-firewall but I'm not really familiar with them.

If you use the method I give above, try restarting iptables with /etc/init.d/iptables start. If things still work, you can use
iptables-save > /etc/sysconfig/iptables

If this doesn't work, it's on to the next step.

SELinux issues

SELinux can cause various issues. I haven't really read up on it yet, so all I can say is that it's been known to cause problems with samba. One can temporarily disable it with setenforce 0

This puts it in permissive mode rather than disabling it. If you feel you need to completely disable it, edit /etc/sysconfig/selinux. There will be a line in there like SELINUX=enforcing or SELINUX=permissive. Comment out that line by putting a # in front of it. If there is a line reading SELINUX=disabled with a # in front of it, remove the #. Otherwise, after commenting out the existing line add the line
SELINUX=disabled

reboot and try again. If it still doesn't work, it might be a combination of iptables and SELinux, so it's worth going back to the above section and trying those tricks again--start with /etc/init.d/iptables stop, and if it works then, just repeat the instructions I gave above, about inserting lines into your iptables. If things still aren't working, on to the next step.

Not having a user with the Windows username and password

Another common issue is that newcomers to samba don't realize the Windows user has to be in the samba password database. There are various forms of security that you can choose in smb.conf, but the average home user usually has either user or share. Authenticating against Windows AD servers, NIS or LDAP is beyond the scope of this brief article.

If you have a user named john with a password of 1234 on the Linux machine and a user named john, with a password of 2345 on the Windows machine, it's not going to work. John's 2345 password has to be added with pdbedit or smbpasswd.
smbpasswd -a john

You'll be asked to give john a password. It should be the same one that he has on the Windows box. With pdbedit it's
pdbedit -a -u john

You will again be asked to give john a password.

In many cases, john will also need a regular user account on the Linux box, that is, one done with adduser, that is in /etc/passwd. However, his regular user account password can be anything, it's the smbpasswd that has to match his Windows password.

If it's still not working, here's another that is often overlooked.

Not having nmb running

The nmbd daemon is usually necessary for the Windows clients to successfully interact with the samba server. The newcomer might not realize that it's connected to samba. The easy way to check is
pgrep nmbd

If you get a PID number back, all well and good. If you get nothing, then it means nmb isn't running. Start it with /etc/init.d/nmb start and also, assuming that you run samba at bootup, add it to the list of services to run when the machine is turned on.
/sbin/chkconfig nmb on

There are times when the newcomer, or careless experienced person, forgets to start up smb too. :) Like nmb, when samba is installed, a script is put into /etc/init.d/ and smb can be started, and added to services to be run at bootup in the same way as nmb. If nothing has worked so far, make sure that you did remember to start smb, using pgrep again.
pgrep smbd

If it's still not working, then on to the next step.

Mounting and getting the unknown filesystem error

This is an easy one, and common. The syntax used to be mount -t smbfs when mounting a Windows share. The smbfs system was gradually superseded by cifs. At one point, either one worked, then, (I think) smbfs worked with a warning that it was going to be deprecated. Now, at least in Fedora, only cifs is supported. So, if you tried to mount using -t smbfs, or mount.smbfs, even though it's still in the man page, at time of writing, you'll get an error of smbfs being an unknown filesystem. Use mount -t cifs or mount.cifs.

When all else fails

In /usr/share/doc there is is a samba directory. It will be called samba-3.0.28 or whatever your version of samba is. If you do a cd to /usr/share/docs/samba-3.0.28 (or whatever version you have) you will see that there is a pdf in there called Samba3-HOWTO.pdf. It has a troubleshooting section which will take you through some tests, with possible causes and fixes for the tests that fail.

If the guide hasn't been included, then the troubleshooting section can be found here at time of writing. (March, 2008). If none of my simple solutions have fixed your samba problems, there's a good chance that the troubleshooting section will either give you the solution, or at worst, give you hints as to what else might be wrong.