LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-29-2010, 07:06 AM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Rep: Reputation: 37
samba server configuration on linux.


Today I have configured samba server on my linux machine .I thought it would be better if i share it here and get feedback from an experienced users.

This configuration is based on Redhat release 5.

Code:
# lsb_release -a
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: EnterpriseEnterpriseServer
Description: Enterprise Linux Enterprise Linux Server release 5.2 (Carthage)
Release: 5.2
Codename: Carthage

First check to see if samba server is installed or not.

Code:
# rpm -q samba
package samba is not installed
However you can find samba client installed on most of Linux Distributions.

Code:
# rpm -qa | grep samba
samba-common-3.0.28-0.el5.8
samba-client-3.0.28-0.el5.8

To get the samba server package the best place to for is your Distribution disk.
I have searched my OS disk and found following package for samba.
samba-3.0.28-0.el5.8.i386.rpm

install the above package on the system using.
Code:
# rpm -ivh samba-3.0.28-0.el5.8.i386.rpm

After successful installation just run “rpm –q samba “ To check if samba is installed or not.
Code:
# rpm -q samba
samba-3.0.28-0.el5.8
Samba configuration file is stored at following location.
Code:
/etc/samba/smb.conf
Samba service name.
Code:
smb
To start samba service at system starup use chkconfig command.

To check the current runlevel of smb service.
Code:
# chkconfig --list | grep smb
smb 0:off 1:off 2:off 3:off 4:off 5:on 6:off
To start the service at system startup use.
Code:
chkconfig --level 345 smb on
reconfirm with below command.

Code:
# chkconfig --list | grep smb
smb 0:off 1:off 2:off 3:on 4:on 5:on 6:off
restart the machine and check the smb service status.
Code:
# service smb status
smbd (pid 4712 4671) is running...
nmbd (pid 4684) is running...

create samba users.

First, lets create the smbpasswd file that we defined in the smb.conf file. The best way to go about this is to create it based on your existing /etc/passwd file. In other words, samba users are created based on existing linux users:
Code:
cat /etc/passwd | mksmbpasswd.sh > /etc/samba/smbpasswd
after execution a new file will be created under /etc/samba directory.
Code:
#ls /etc/samba/
lmhosts passdb.tdb secrets.tdb smb.conf smb_orig.conf smbpasswd smbusers
the password for samba user is not similar to existing system users.
We need to manually set the samba user.
Code:
# smbpasswd root
New SMB password:
Retype new SMB password:
Now its time to edit samba configuration file .
Take a backup of original file using.
Code:
# cp /etc/samba/smb.conf /etc/samba/smb_orig.conf
Delete all entries.Add following values inside the configuration file .

Code:
*************************************************************

[global]
workgroup = PUTIEVILLE
server string = My Lil Linux Box
hosts allow = 192.168. 127.
log file = /var/log/samba/%m.log
security = user
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

[Downloads]
comment = Downloads
path = /tmp
browseable = yes
writable = yes
public = yes
read only = no

[homes]
comment = My Home Directory
browseable = yes
writable = yes
public = yes
read only = no

[printers]
path = /var/spool/samba
public = yes
guest ok = yes
printable = yes
browseable = yes
writable = yes
read only = no
******************************************************
Description:

Code:
[global]
hosts allow = 192.168. 127.
This line will allow samba server accessible from 192.168. series and localhost .

Code:
smb passwd file = /etc/samba/smbpasswd
This will tell samba to use smbpasswd file from mentioned location

Code:
[Downloads]
comment = Downloads
Name of the share
path = /
Path that should be made available for all.


Restart the smb service and access the files through windows login.

Last edited by pinga123; 07-29-2010 at 08:06 AM.
 
Old 07-29-2010, 07:19 AM   #2
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
Quote:
path = /
browseable = yes
writable = yes
public = yes
Why you share "/" with writable permission for public?
 
Old 07-29-2010, 07:26 AM   #3
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by sem007 View Post
Why you share "/" with writable permission for public?
It was done for testing purpose however i shouldnt have posted it as it is.I m modifying the post. Thanks .
 
Old 07-29-2010, 07:44 AM   #4
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
Hi pinga123,

That's quite a comprehensive guide.

2 things I would do differently:

1. Installing samba - on RHEL/CentOS; I'd say you should rather use yum and install the latest version available (as your distro disk will have the version released when you created that disk) - yum repositories will have the latest.

2. For a basic samba share I'd use system-config-samba since this will save you time. For fancier stuff (for example differing access control to differing shares etcetera) I'd edit the smb.conf directly.

Thanks
 
Old 07-29-2010, 07:49 AM   #5
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by alli_yas View Post
Hi pinga123,

That's quite a comprehensive guide.

2 things I would do differently:

1. Installing samba - on RHEL/CentOS; I'd say you should rather use yum and install the latest version available (as your distro disk will have the version released when you created that disk) - yum repositories will have the latest.

2. For a basic samba share I'd use system-config-samba since this will save you time. For fancier stuff (for example differing access control to differing shares etcetera) I'd edit the smb.conf directly.

Thanks
Code:
# system-config-samba
-bash: system-config-samba: command not found
Which version of samba you are talking about?
I think i have pretty old version.Can u guide me on yum installation. I think yum requires redhat license to be purchased if i m not wrong.

Last edited by pinga123; 07-29-2010 at 07:51 AM.
 
Old 07-29-2010, 07:52 AM   #6
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
You need to install it first:

Code:
yum install system-config-samba
 
Old 07-29-2010, 07:58 AM   #7
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by alli_yas View Post
You need to install it first:

Code:
yum install system-config-samba
This is what i get when i execute the instruction
Code:
# yum install system-config-samba
Loading "security" plugin
Setting up Install Process
Parsing package install arguments
No package system-config-samba available.
Nothing to do
 
Old 07-29-2010, 08:03 AM   #8
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
Is your machine registered with the Red Hat RHN Repository?

On RHEL 5 and CentOS 5; I have found the package:

Code:
# yum list system-config-samba
Loaded plugins: rhnplugin, security
Available Packages
system-config-samba.noarch                                                                                         1.2.41-5.el5                                                                                          rhel-x86_64-server-5
 
Old 07-29-2010, 08:06 AM   #9
teebones
Member
 
Registered: Aug 2005
Location: /home/teebones
Distribution: sometimes this, sometimes that..
Posts: 502

Rep: Reputation: 56
Use the search option within yum to find the exact name.

Secondly, in general: NEVER ever test things with all things granted, like in this case your share testing with path "/"
those kind of lazynesses, can lead to severe security issues, you (as beginner) cannot imagine it's magnitude. (and potentially for others too, when connected to the "net")

Also never use root user for such things (testing), always make a separate user with as minimum rights as needed for the job.
(incl. group ofcourse)
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Samba Server Configuration - Error raj.mahanty@ismt.co.in Linux - Networking 1 07-19-2010 03:08 AM
Samba Server Configuration issue ceantuco Linux - Newbie 3 08-31-2009 03:11 PM
Samba Server Configuration amithad Linux - Networking 1 11-11-2008 09:24 AM
sme server samba configuration = need help jaxd Linux - Networking 8 11-17-2006 04:00 AM
configuration of samba server lalit.poswal Linux - Networking 5 11-09-2006 01:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:25 PM.

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