Share your knowledge at the LQ Wiki.
Go Back > Linux Answers > Networking
User Name


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;
smbd start
nmbd start
Then make sure BOTH smbd and nmbd are in the process list:
ps ax
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.

by MJRehrig on Sun, 2006-03-19 12:43
I can never get past the inetd part, it is not listed in ps ax. Can anyone help me? Thank you.

by lchata on Sun, 2006-05-14 02:09
I'm a newbie to samba, too. but if you are using Debian stable, the file name for inetd is changed. Do a 'locate' inetd and it should pick up the Debian full name which you must use to start or stop it. I've been working on sambe for some time now and still not working. Good luck.

by gvaught on Thu, 2006-06-15 21:11
Okay, have either of you gotten any success with Samba?

If not, where in the article are you running into issues?

It's been over a year since I set up a Samba server and I just got mine up and running in about 45 minutes. After installing a newer version of my OS.

One item that I found helps a LOT is once you get your server configured and it's working and life is good execute the following:
$cp /etc/samba/smb.conf /home/config/etc/samba/smb.conf

And I'd recommend doing this with ANY configuration file you have to tweak - back that sucker up. Makes reconfiguring it after an OS failure much easier. Not perfect, but easier.

by mariogarcia on Sat, 2008-01-05 20:34
if you kill inetd swat will not work. it says server not found; in debian sid/unstable inetd must be running for swat to work!

by gvaught on Sun, 2008-01-06 09:37
If your system is set up with inetd to run automatically (on boot) then when you kill the process, it should restart on its own. If it does not restart on its own, then you will need to locate the file which does start it and run that file.


All times are GMT -5. The time now is 05:50 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration