Samba can run on most Unix and Unix like system such as Linux, Solaris, BSD and also Mac OS X server. Samba usually is a standard package come with the Linux distribution can commonly included as basic system service in Unix based OS. Samba is an Open Source Software under GNU GPL.
Below tutorial is for setup Samba in Centos 5.3.
The test system is Centos 5.3 with the hostname localhost.localdomain and IP 192.168.1.100
1. Please disable the SELinux before we begin.
setenforce 0
2. Install Samba
yum install cups-libs samba samba-common
Then edit smb.conf file
pico -w /etc/samba/smb.conf
Please see at the [global] section:
# Backend to store user information in. New installations should
# use either tdbsam or ldapsam. smbpasswd is available for backwards
# compatibility. tdbsam requires no further configuration.security = user
passdb backend = tdbsam
This will enable user to login to Samba server. Then create the system startup link and start the Samba.
chkconfig –levels 235 smb on
/etc/init.d/smb start
3. Adding Samba shares that is accessible by all user that will use the server. Create a directory for sharing the files and change the group of the user to the users group.
mkdir -p /home/shares
chown -R root:users /home/shares
chmod -R ug+rwx,o+rx-w /home/shares
At the end of /etc/samba/smb.conf add the following lines:
pico -w /etc/samba/smb.conf
[shares]
comment = All Users
path = /home/shares
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
writable = yes
This will enable sharing for the folder shares for anybody that access the server. For single user that want his own folder that he can read and write to that folder, add the following line on the configuration(smb.conf).
[homes]
comment = Home Directories
browseable = no
valid users = %S
writable = yes
create mask = 0700
directory mask = 0700
Then restart the service.
/etc/init.d/smb restart
4. Adding and managing users for Samba.
Just add user to the server. You can add user from terminal or you can also add using gnome. The faster way to add user is by using terminal.
useradd alias -m -G users
passwd alias
If dont want the user to login to the system, just skip the password creation.
After that, add the user to the Samba user database.
smbpasswd -a alias
and create a password for him.
5. alias now have access to the shares folder and his home directory in Linux system. He now will be able to login to the Samba shares with IP \\192.168.1.100 or \\192.168.1.100\alias using the username and password created for the Samba user.