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.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

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:
192.168.1.1:901

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 sharessmbfs - without this, you'll never get anything to mountsmbclient - 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?