Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
By gvaught at 2005-04-02 02:10
This may be documented elsewhere, but I didn't find it all together.
The first thing I did was spend some time reading the Samba docs. I highly recommend this, but you're not reading this to get advice on what to read.
AND, if you're a bit ADD like myself these tips could help avoid hours/days/weeks trying to figure it out by T&E. READ THIS ENTIRE DOCUMENT BEFORE YOU EVEN LOOK FOR A SAMBA DOWNLOAD. I do not want to be responsible for people starting their setup before they're prepared and having to reinstall the server or even their OS.
I'm not going to go into how to install the programs on every distro you could have on your "server", as the docs are pretty good at going through that AND it's not difficult to get them running. The difficulty comes in getting them configured. sigh
I am going to describe how to get things going on Debian Sarge. I'm using the Net Installer rc2 and the 2.6.8 kernel. Not that it matters a lot, but I thought I provide that info. From a command line, enter the following:
apt-get install samba
apt-get install swat
During installation, select to run Samba as a daemon on "server". Major point of note:
You must add users to your Samba server before they will be able to access the shares. I have spent three days struggling with a server that was working as Slackware 9, then I rebuilt it with Debian Sarge (easier distro from my perspective, simply because of the apt-get commands above) only to have Samba refuse my efforts to access it. I had saved (and reused) my /home fs (which housed all of the shares) and had backed up my Samba config files to my home directory. I attempted to re-use these, since I knew they worked. But I continually got this stinkin' dialogue box asking for my username password - and then refused to accept my valid (Linux) username and password.
The key thing to watch for, from my experience, is the dialogue asking for a username and password when you try to open your share (esp. if it *was* working).
I strongly suggest making the Linux, Windows, Samba and/or domain usernames and passwords the same, to reduce the number of logins required. At least, for home or small business networks and while learning. Larger companies may get some benefit from a separate Samba password, but that's more advanced than I am, or what I feel comfortable in advising users on.
Now, to add users to the Samba server so they can connect:
smbpasswd -a <username>
After that, enter their samba password twice. Once done, the user is in and should be able to mount the share from a Windows box when the server is started.
With this done, start (this works for restarts, also) the daemons either with SWAT or with the following at the command line on the server;
Then make sure BOTH smbd and nmbd are in the process list:
SWAT will run on this same system under inetd.
Restart inetd. Check your process list (above) for the PID (process ID) of inetd. Then enter the following:
kill -1 inetd_PID
When sure smbd and nmbd were running on "server", go to a box with a GUI (haven't tried this on the same box, so can't comment on how it works) and a web browser - ON THE SAME NETWORK. In the address bar, put in the IP address of the "server" and the SWAT port number (901) as follows:
Log into SWAT as root (use the root password from the server) or another administrator-privileged user and make the changes necessary to the Samba configuration (mostly in General and Shares) and commit them. Once the changes are committed (written to the smb.conf file) you need to go to the Status section and restart smbd and nmbd.
Use of SWAT is highly recommended - once I got this working, the rest of configuring the server fell into place (and the guess work vanished).
When configuration is set on your server, test your setup from the server and with a Windows box.
On the server, check/test your smb.conf file by entering the following on the command line:
This will work as is, as long as you haven't moved your smb.conf file.
Once this is done, go to your Windows box and click Start>Run. Enter '\\server\' and a list of the shares available will appear in the drop list (after you put in the trailing backslash). You can mount them from there or use the Tools menu from My Computer.
If you don't have a Windows box on your network, you really don't need Samba - you can use NFS. Once you can mount the shares in Windows, make sure you have Samba, smbfs and smbclient installed on any Linux client/remote computers on the network. I don't know for sure if they're all necessary for mounting a Samba share, but I did end up with all three on my box and I believe they're all helpful. samba - needed to even consider accessing a system with SMB shares smbfs - without this, you'll never get anything to mount smbclient - this was a great troubleshooting tool - it allowed me to see that the shares were there, accessible, and focus on my client-side configuration instead of guessing that my server was good-to-go
For the sake of all that keeps us sane - get the syntax for mounting the shares on Linux correct. Once I figured out what I was doing incorrect, I could have kicked myself for blowing the syntax for weeks.
mount -t smb //server/share /mount/point -o username=xxxxxx,password=xxxxxx
user and name won't work - it has to be username. Trust me.
This is not, by any means, an exhaustive HOW-TO on Samba - it's meant to get you past the stumbling blocks I ran into and help you avoid the pain and suffering I went through.