Download your favorite Linux distribution at LQ ISO.
Go Back > Linux Answers > Networking
User Name


By gvaught at 2006-06-15 21:03

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, if you're a bit ADD like myself these tips could help avoid hours/days/weeks trying to figure it out by T&E.

I'm not going to go into how to install the programs 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

(1) I installed the Samba server and daemon on my "server" box. When this is done, make sure BOTH smbd and nmbd are in your process list (ps ax).

(2) Install SWAT on this same system and make sure it is running, also. If you have challenges with this, check the SWAT chapter in the Samba manual on-line.

(3) When you're sure smbd and nmbd are running on your "server", go to a box with a GUI (I didn't try this on the same box, so I 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
Samba port number (901) as follows:

Then you should be able to log in as root using the server's root user and make the changes necessary to the Samba configuration (mostly in General and Shares) and commit them. Once the changes are
commited (written to the smb.conf file) you need to go to the Status section and restart smbd.

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

(4) When you're pretty sure you have your configuration set on your server, test your setup with a Windows box. (Start>Run, '//server' should list the shares available in the drop list) 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 your Linux client/remote computer. 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

(5) For the sake of all that keeps us sane - get the syntax for mounting the shares correct.

Once I figured out what I was doing incorrectly, 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.

This is not, by any means, an exhaustive HOW-TO on Samba - it's meant to show (1) the stumbling blocks I ran into and (2) how to avoid the pain and suffering I went through.
Major point of note:
You must add users to your samba server before they will be able to access the shares. I have spent the past three days struggling with a server that was working as Slackware 9.1, then I rebuilt it with Debian Sarge (easier distro from my perspective). 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, for the meat of this post - how to add users to your samba server so they can connect:

smbpasswd -a username

After that, you'll be asked to enter their samba password, twice. Once done, they're in and should be able to mount the share from their Windows box.

Some FYI for folks wondering why I do this. First of all, why am I sharing here? I need to document (somewhere "off site") what I've done so *I* can come back and figure out how to do this, again, when I need to do it again. Plus, I feel I should give back after all of the help I've received here.

Second, the samba server allows me to have access to my files whether I'm in Windows or Linux - the same files. So I don't have to have two copies. I don't have to reboot into Windows to download a file for Windows. And it gives me a great place to store my music and photos to share with everyone else on the network. And them to share their files with me.

I hope this helps SOMEONE besides me. If not, why did you bother to read this far?


All times are GMT -5. The time now is 03:25 AM.

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