Home > HowTo, Linux > Setup Samba Howto

Setup Samba Howto

November 26th, 2008 Leave a comment Go to comments

Howto Setup Samba

Reference to my newer post (RedHat/CentOS)

Install the packet:

# apt-get install samba

Check your open port:

# netstat -an |grep listen

No port 139 ?

Create the user accounts and sync the password with Samba

# adduser share

# smbpasswd -a share

# smbpasswd -a nobody

Configure the smb.conf

[global] netbios name = dbox                                                                                                                                                                                                                                                                       workgroup = pratica
server string = %h server
# This will prevent nmbd to search for NetBIOS names through DNS.
dns proxy = no
#### Networking ####
# The specific set of interfaces / networks to bind to
interfaces = <YOURIP>/eth0
#### Debugging/Accounting ####
# This tells Samba to use a separate log file for each machine that connects
log file = /var/log/samba/log.%L
max log size = 1000
syslog only = no
syslog = 0
panic action = /usr/share/samba/panic-action %d
#### Authentication ####
security = user
encrypt passwords = true
# password database type you are using, for encrypted passwds
passdb backend = tdbsam
obey pam restrictions = yes
guest account = nobody
invalid users = root
passwd program = /usr/bin/passwd %u
passwd chat = *EntersnewsUNIXspassword:* %nn *RetypesnewsUNIXspassword:* %nn *passwordsupdatedssuccessfully* .
############ Misc ############
socket options = TCP_NODELAY
#======================= Share Definitions =======================
[carp1]
comment = R/W Shared Folder
browsable = yes
writeable = yes
path = /home/carp1
locking = no
public = yes
guest ok = yes
valid users = nobody, guest
[carp2]
comment = Read Only Shared Folder
path = /home/carp2
writeable = no
browsable = yes
locking = no
guest ok = yes
public = yes
valid users = nobody, guest
[carp3]
comment = Authenticaion Required Shared Folder
path = /home/carp3
writeable = yes
browsable = yes
locking = no
guest ok = no
public = yes
valid users = share

Cool tools:

smbclient
The smbclient program implements a simple ftp-like client.  This  is
useful for accessing SMB shares on other compatible servers (such as
Windows NT). -L (just list) -U user[%passwd] -N (no passwd)

# smbclient -L  //LOCALHOST

Note: with Samba 3, it dosent come installed by default, to install do:

# apt-get install smblcient

smbstatus
The smbstatus tool provides access to information about the  current
connections to smbd.

smbpasswd
The smbpasswd command is a tool for changing LanMan and  Windows  NT
password hashes on Samba and Windows NT servers.

smbtree
The smbtree command is a text-based network neighborhood tool. Scan subnets for available share and prints a nice tree.

net
The net command is supposed  to  work  similar  to  the  DOS/Windows
NET.EXE command.

nmblookup
Does a lot of nice tricks, can be used to output same as nbtstat -an, like:

# nmblookup -M -R -S -A  127.27.101.164

swat
swat is a web-based interface to configuring smb.conf. Make life much easier! To install do:

# apt-get install swat

Then just open the browser to port 901 http://<IP>:901

VAMOVE *

*