Linux.com

Feature: Enterprise Applications

Quick and dirty Samba setup

By Joel Nahrgang on November 28, 2006 (8:00:00 AM)

Share    Print    Comments   

Samba is an open source project that allows Windows users to connect to a Linux server from which to share data. If you are looking for a simple, affordable home file server, or need more disk space on your office network, a Linux server with Samba is the way to go. Linux along with Samba offers a stable, secure environment that is available at no cost, along with features such as remote administration, immunity to Windows viruses, and the ability to run on low-end machines. Here's how you can set up a simple Samba server on Slackware for SOHO use.

Most current Linux distributions, including Slackware 11, have Samba already installed and running after the system boots. This article assumes that Samba has been installed. The commands work for Slackware version 11 and 10.2, and likely many other Linux distros.

The first step is to create a share folder on your hard drive; for instance, /disk2/data. After that, you need to edit the smb.conf file, found in /etc/samba, and make it look something like this:

# Global parameters
[global]
       workgroup = HOME
       netbios name = SAMBA
       server string = Samba Server %v
       map to guest = Bad User
       log file = /var/log/samba/log.%m
       max log size = 50
       socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
       preferred master = No
       local master = No
       dns proxy = No
       security = User

# Share
[Data]
       path = /disk2/data
       valid users = joel
       read only = No
       create mask = 0777
       directory mask = 0777

You can copy and paste this into your conf file or make changes to your existing one.

The workgroup name needs to be the workgroup of your Windows computers, or your domain name. The netbios name is what will appear when you access the Linux computer from Windows. I am currently running a Windows domain with this setup, so I have the preferred master and local master set to no to avoid both servers from attempting to be the master browser. This will eliminate network conflicts on your Windows computers that can cause network-related outages.

For the share details, specify the valid users, or set them up later. In that section you can allow users to create their own folder and files for all to access.

The next step is to add users by the following command:

# useradd -c "Joel Nahrgang" joel
# smbpasswd -a joel
New SMB password: secret
Reenter SMB password: secret
Added user joel

Next, run the testparm command to ensure that the conf file is valid. If it returns no errors, restart Samba with the command /etc/rc.d/rc.samba restart. You should also make Samba executable when the server is rebooted with the command chmod 755 /etc/rc.d/rc.samba.

If you would like to tidy up your smb.conf file, the following commands will back up the file, then remove all the comments for easier reading:
# cd /etc/samba
# cp -a smb.conf smb.conf.master
# testparm -s smb.conf.master > smb.conf

Now you're ready to test Samba. On a Windows computer, you can either map a drive to the Samba server or access the drive using the Start-Run command and typing \\Samba\data, "Samba" being the server name and "data" being the shared folder.

One disclaimer: this setup serves a small network or a home network. For a larger user base and more complex network configuration, you may want to use the documentation provided on the Samba Web site.

Share    Print    Comments   

Comments

on Quick and dirty Samba setup

Note: Comments are owned by the poster. We are not responsible for their content.

samba

Posted by: Anonymous Coward on November 29, 2006 02:34 AM
Sweet.

#

Re:samba

Posted by: Anonymous Coward on November 29, 2006 03:00 AM
Nice!

A similar article here:
<a href="http://www.foogazi.com/2006/11/01/simple-samba-slackware-setup/" title="foogazi.com">http://www.foogazi.com/2006/11/01/simple-samba-sl<nobr>a<wbr></nobr> ckware-setup/</a foogazi.com>

#

Another link, for home use, with no security

Posted by: Anonymous Coward on November 29, 2006 08:50 AM
<a href="http://kimbriggs.com/computers/computer-notes/linux-notes/samba-setup-guide.file" title="kimbriggs.com">http://kimbriggs.com/computers/computer-notes/lin<nobr>u<wbr></nobr> x-notes/samba-setup-guide.file</a kimbriggs.com>

cheers,
KB

#

webadmin to the rescue !

Posted by: Anonymous Coward on November 30, 2006 05:00 AM
"any suggestions?"

Yes. I had the same concerns with configuring ftp for Linux. I know ftp isn't terribly difficult to configure, but I didn't want to read a lot of manuals and I was tired of sifting through text files. Someone told me about webadmin. I installed it and configuring ProFTP was a breeze. FWIW, my server is headless and has been for about 2 years now.

<a href="http://webadminmodules.sourceforge.net/?page=Welcome" title="sourceforge.net">http://webadminmodules.sourceforge.net/?page=Welc<nobr>o<wbr></nobr> me</a sourceforge.net>

I've never run Samba. I only notice that webadmin has a module for it and a lot of other services.

#

Re: samba

Posted by: Anonymous [ip: 69.207.93.149] on January 17, 2008 04:40 AM
Thx,
This worked for me.
I have tried to get samba to work for a while.
At different times I couldn't get my linux box to talk to my windoz bow
Finally I used this basic conf and it works.
I am now able to open a program on my windows box and open a file that resides on my linux box

now I just need to figure out some of the security fratures and Im all set

#

Samba and the failure of the distros

Posted by: Anonymous Coward on November 29, 2006 04:05 PM
I think Samba is a great tool, but as an IT Manager, network administrator, server administrator, etc., it lacks the ease of use to make it a great tool for a small to medium size business. I am very capable in Linux, as well as in a Windows environment. I can get Samba to work, and pretty easily, but not for network wide integration into a Windows/Linux mixed environment. Will it work? Yes. Can it work well? Yes. But, I will spend days trying to get all the components of an LDAP/Samba-PDC network working, when I can get a Windows Server up and running in hours. I can get Linux up and running in minutes, but the tightly integrated tools to make it the primary server in a mixed linux/Windows environment are just not out there. Every other tool is out there, but I have fought so much trying to get it all working, that I want to just give up. Understand, this is the real world and I don't have weeks to read a manual, setup full test environments, etc. to get it done.

As a note, I don't blame Samba or LDAP, just the lack of a fully integrated distro to really make it work well. (any suggestions?)

#

Re:Samba and the failure of the distros

Posted by: Anonymous Coward on November 30, 2006 01:13 AM
I guess it all depends on what you want it to do.
In fairly complex network environments, you're right, it certainly can't provide the fine grained permissions that Windows Server provides. Well, not easily anyway. However, in fairly simple small business environments, it works great and is not that difficult to setup. I have Samba running on Unix to provide a NAS device. It's just a repository on my network for backups (encrypted) and other misc files. Available to everyone. Works great. I also have Samba running on my main Linux server. It's setup to only allow certain users. It can be accessed locally or remotely using SSH. Again, it works great and is not that difficult to setup (minutes/hours, not days/weeks). So again, I guess it depends on what you're trying to do with it.

#

Re:Samba and the failure of the distros

Posted by: Anonymous Coward on November 30, 2006 01:41 AM
Another example.

I've Samba mounting a NAS to provide my *nix workstations with a common network drive. It's been working great though I really want to get Automount in the mix as mounting the Samba share keeps the NAS drive spun up constantly where it should be sleeping after five min of inactivity. My theory is that automounting the share only when used on each workstation would umount the NAS allowing it to sleep. (It's a heat issue, that little aluminium box get's hot when the platters spin constantly.)

On the win32 side, I primarily work with portable apps on an USB along with my commonly references data files. Now, being that everything is designed to function from a USB drive, it also functions perfectly when mounted to a drive letter over a network share.

In this case, my *nix primary workstation boots up with the USB in place to mount and share it out through the Samba (uname and pword locks it down relatively). Should I be working on one of my win32 boot partitions or VM, they can all map t the shared USB drive as if it was plugged into there own chassis.

Just an example of another Samba use incase it helps or inspires someone out there.

My one issue is that the flashdrive does not always mount during the boot so at least two or three times a week my login ritual has to include su to root, stop the samba deamon, rebuild the mounting with user write access, restart the samba drop out of root.. then continue on with life. My theory is that Mandriva isn't mapping drive devices based on the drive's unique identifier so I lose<nobr> <wbr></nobr>/dev/sdc depending on where the USB host decides to place it. If anyone can sudjest the cause or fix I'd be interested to hear it.

#

Re:Samba and the failure of the distros

Posted by: Anonymous Coward on November 30, 2006 05:53 AM
I agree the PDC part is harder.

However, if you have an AD or PDC already setup, you can setup a samba file server that authenticates to the AD/PDC fairly easily. If you run the file server on the AD/PDC, that doesn't gain you much. If you run the file server seperate, you save some performance hit and licensing fees. You can also take advantage of a different files system under samba such as zfs on Solaris.

#

Re:Samba and the failure of the distros

Posted by: Anonymous Coward on November 30, 2006 09:00 PM
Just as a side note maybe to help you out. We have a linux samba server at all 13 branches for our company that are all tied to Active Directory. Simply put, create a user on the linux system with name that matches the AD. Then using I believe a default samba install sharing users home directories and the beautiful command "net join AD_NAME -U administrator_account" will tie it to the DOMAIN. Then add<nobr> <wbr></nobr>//servername/username in the path of the users profile in AD and done. When they logon they get there H: drive or whatever you call it and it is authenticated against AD.

#

Re:Samba and the failure of the distros

Posted by: Administrator on January 26, 2007 11:20 PM
Looks like your config worked. Mine , i still am working on it , for the last<nobr> <wbr></nobr>...what... 8 weeks!

I just can't get the Samba server, even if it is working A1, connect properly and authenticate the users with the actual and working WIndows 2003 Active Directory.

I did try the official Samba config files and how to's and they do not work. They miss important informations and details that a newcomer in the Samba world would miss and get frustrated for not working.
I really need and want to use Samba, $$$ reasons and also security reasons(virus, backups, etc) , but i have a PO in my hands ready to send for a Windows server software.
All the time lost pulling my hair trying to get it to work might have paid for a full WIn licence and a working server.

You have a site or info we could all use to get Sambar working? It would be awesome to get some more info.

thanks !

#

Re:Samba and the failure of the distros

Posted by: Administrator on February 05, 2007 03:17 AM
Try this, setup the user on the samba box, same name and password as the one in the windows computer that you will be accessing the samba share from.

#

Re:Samba and the failure of the distros

Posted by: Anonymous Coward on December 29, 2006 08:03 PM
I have to agree that setting samba 3 up as a pdc is a nightmare. it takes weeks, even now, my romaing profiles don't work and there are little snippets of info here and there on the web bot nothing in one place. Even the samaba HOWTO is plainly wrong in places.

I think it would have been cheaper to buy windows server if you add up all the time i've wasted on this.

#

Re:Samba and the failure of the distros

Posted by: Anonymous Coward on May 20, 2007 06:53 AM
I agree with the assessment of SAMBA. More to the point, I think an alternative to SAMBA - virtually any alternative - might be the solution. With competition, and new players thinking about new ways to do things better, we (the market) typically get better products. It's a little odd, in fact, that no one has stepped up to challenge SAMBA with some different way to skin the same cat.

#

Re:Samba and the failure of the distros

Posted by: Administrator on February 05, 2007 03:23 AM
I kind of agree with you here. I have it setup this way. The domain controller is windows, this just works. I have 5 boxes serving as samba/file/print/backup/etc boxes. Using the same setup as in the article, this works without trying to get samba to be the pdc (I have tried without any luck before I migrated to windows server 2003). Unfortunately, I think I will have to stick with at least one windows server for the near future.

#

Contacting Win XP PC from a MacBook (Mac OS X)

Posted by: Anonymous Coward on November 30, 2006 02:04 AM
That's my question:
Somehow I cannot connect a Win XP PC from a MakBook (Mac OS X). Win XP has the gues account disabled. The Finder of the Mac OS X does not ask me for the the user and password. It just replies wrong password or suername though I didn't stored any in the Key Chain.

After lots of consultations I came to the idea that this might be due to the SMB instalation. Some bug...

Any suggestions?

Thanks!

#

Re:Contacting Win XP PC from a MacBook (Mac OS X)

Posted by: Anonymous Coward on December 01, 2006 08:39 AM
you just need the same username on both winxp and mac osx. Works a treat! Not had any problems using that method.

#

cool

Posted by: Administrator on December 01, 2006 01:46 AM
lmao, its dirty but it works

#

Won't work

Posted by: Administrator on December 12, 2006 10:21 AM
Typed everything in exactly as it was presented, but it won't work for me. My Windows machine sees the Samba machine, but when I try to connect it says I can't and suggests I don't have rights to it. Doesn't even give me a chance to log in. Not sure what the problem is. Sigh...I hate being a noob...

#

Re:Won't work

Posted by: Administrator on January 14, 2007 04:06 AM
Check the linux firewall , enable samba in the firewall.
good luck

#

Re:Won't work

Posted by: Administrator on February 05, 2007 03:19 AM
Try this, setup the user on the samba box, same name and password as the one in the windows computer that you will be accessing the samba share from. Make sure the user name is in the valid users section as well.
Also, all of my boxes where I work have the firewall alowing samba to come through. (email me if you have more problems joelsn at gmail dot com).

#

Re:Won't work

Posted by: Administrator on January 14, 2007 05:07 AM
Thanks marcexx66, I'll give it a try.
KP

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya