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.
/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.
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.
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.
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.
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.