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


By cdabb at 2005-02-07 10:08
Basic Samba Network File Sharing

Introduction to Samba Server:

Samba can be setup to function as different types of network server. In this article we will cover the basic Samba setup for the Novell Linux Desktop. This document will cover the following areas of the Samba server:

1. Samba Server Types overview
2a. Basic file sharing with MS Windows computers
2b. Samba Server User Accounts & Services
3. Mounting MS Windows File server
4. Troubleshooting

1. Samba Server types:

This is a list of the main Samba server role.

1.Domain Controller
ADS Domain Controller
Primary Domain Controller
Backup Domain Controller

2.Domain Servers
Active Directory Domain Server
NT Domain Servers
3. Stand-alone Server

This list can be found at Samba's web site:

2a. Basic Samba Stand-Alone File Server:

To setup the Samba server you will need to have root privileges. Go in to the Samba directory and edit the smb.conf file.

# su
# cd /etc/samba
# vi smb.conf

To setup a basic share in Samba you will need the following entrys.

# The workgroup is going to be setup to your internal networks workgroup or domain.
workgroup = TUX-NET

# Netbios name it going to be the computer name of the Samba server.
netbios name = NOVELL

# Server string is the equivalent of the NT Description field
server string = Linux Samba Server

# Samba Security Setting
security = user

# You may wish to use password encryption. If you are going to be connecting from a windows 9x computer you will not want to enable this option. Windows 2000 and up, you will want to enable the encrypt passwords.
encrypt passwords = yes

# Set local master to no if you don't want Samba to become a master browser on your network. You may want to have this turned off by default.
local master = no

#===== Share Definitions =====
# This part of the smb.conf is where you setup the network share

This will let the the home directory get shared. All users home directory on the computer will show up with if this is added. (Note: You will only be able to access you own home directory by default. Other users directory's will not show up in your network browser unless you have setup the permissions to let you access it. most of the time you will want to comment out this entry.

comment = Home Directories
browseable = yes
writable = yes

# Here is a private directory that can only be accessed by tim. (Note: tim will need to have write access to this directory)

comment = Tim's Share
path = /usr/somewhere/private
valid users = tim
public = no
writable = yes
printable = no

2b. Samba Server User Accounts & Services

Now that the smb.conf file has been setup you will need to add the Samba user account. The Samba user account will tie in with your local Linux account. The password to access the Samba can be setup to use the same or different password than your local account. In the example you will see the -a option, this will tell Samba to add the users account to the smbpasswd.

# smbpasswd -a tim

To change a users Samba password use the same command as above with out the -a option. Now you can start the Samba service.

# /etc/init.d/smb start

To have the Samba service start on boot, use the chkconfig tool:

# chkconfig

by Bill Johns on Mon, 2005-04-25 02:26
It is
testparm on mandrake 10.1

by Damon Spector on Sat, 2005-04-30 11:49
I followed the instructions intel I got to the

# /etc/init.d/smb start

line and I got the message

-su /etc/init.d/smb: no such file or directory

and now I cant get that computer on the Internet even can you tell me how to fix this problem. I am running Slackware 10.1

by Damon Spector on Sat, 2005-04-30 14:26
please disregard the problem about the Internet. it was a totally unrelated problem that I have now solved.

by bayvista on Sat, 2005-07-23 23:27
Good Article. However, you assume knowledge of "VI" (VIM)?. I got this far but how do I save my changes to SMB.conf? At the present, I seem to have completely lost it.
David (Newbie, of course)

by bigjohn on Tue, 2005-07-26 14:31
Well, I saw the title and hoped that all my current samba prayers were answered.


As soon as I do
vi smb.con
I'm screwed. My system is nothing out of the ordinary. I only want to network a laptop to my main pc so that the laptop can access the printers (overriding necessity) plus if I could work out how I'd also like to be able to move/share files between both machines, but what I see in the "vi window" only seems to bare a passing resemblence to whats in the tutorial.

My smb.conf seems to have many more entries than the example in the tutorial, and hence I have no way of knowing whether removing any of the addtional entries my smb.conf seems to have, is likely to be detrimental to either machine/the system overall.

It seemed to start well, but that was it.

This isn't meant as a criticism, just how I see it from in front of my monitor! I'm unable to tell if it's just that I'm using a different distro or what.

Though well done to the author for having the "smarts" to be able to even write the tutorial in the first place - I couldn't do it. Just because it hasn't been of any real help to me, doesn't mean that other won't benefit!



by bayvista on Tue, 2005-07-26 19:19
Hi John,

What you need is "Linux Installation and Getting Started Guide". This is part of the Linux Documentation Project (LDP). Website is: This gave me the right commands and sequence and eventually I got my Linux box into my home network.
Most importantly, it gave an explanation of VIM, the editor you need to use.
Unfortunately, with Linux, you need to do a lot of reading before anything works. It's basically like Windows 3.1, if you go back that far.

Good luck.

David (semi Newbie now)

by bigjohn on Wed, 2005-07-27 07:48
Cheers David, I'll go and have a look at that link.

vi I can do enough to get by, but I'm not so happy with tldp (one of my "soap box subjects" is documentation).

The collation methods of the tldp, fine, but it's not so good for newbs who need the info put in a form thats straight forward i.e. "plain english". Hence it's my belief that just putting it all in a this, that, the other, etc provides the info, but so do man pages and that format is equally unintelligible.

It's the newbs who need good quality docs the most, those with reasonable "prior knowledge" can always skip the "hand holding" part(s).

Still, if the link gives me the basic stages of what I'm supposed to be doing, it may help some.

Again, many thanks.



by Douwe on Tue, 2005-09-06 03:17
Originally posted by cdabb
This thread is to discuss the article titled: Basic Samba Network File Sharing
The article did NOT work out for me.
You only talk about servers: a Samba server (your Linux box I presume) and a Windows server. No clients?
You don't tell us what kind of windows (95,98,xp home, xp pro, some more) you connect to.
After setting up /etc/samba/smb.conf (vi is no problem for me, others: choose 'joe' or another easy editor), I want to connect to my Win XP-home box.
typing litteraly:

$ su
# mount -t smbfs //servername/share /mountpoint -o username=douwe

gives all kind of errors.
I can understand that /mountpoint has to exist on my linuxbox, but what to fill in for //servername/share???

I have another Win98 SE box, that I would like to connect to my linux-box via Samba.
Both Windows-computers and the Linux-box are connected to the internet via a Freesco router, and I can browse the internet on each of them.
I have no idea how to prepare a Windows box for the samba-job.
Please give some indication where to find this.
Indeed: I have more knowledge of Linux than of MsWindows(tm).

PS. also here the command is:

Please cdabb, correct this in your story.

by bayvista on Tue, 2005-09-20 19:29
Can someone explain what 'mountpoint' means in the 'mount' command?
I believe that I have to mount the samba share before I can access it in Windows


by carl h on Sun, 2006-03-12 15:17
I'm using Fedora Core 4, and the correct command is "testparm", not "testpram" as it says in the article.


All times are GMT -5. The time now is 10:26 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