Saturday, June 29, 2013

Your First Simple Samba Server on CentOS

Samba is a free software re-implementation of the SMB/CIFS networking protocol, provides file and print services for various Microsoft Windows clients and can integrate with a Windows Server domain.


In the end of this tutorial you will be able to install and configure samba to work in Microsoft workgroup environment.

For the sake of the simplicity of this tutorial you need to turn off the firewall and SELinux.

 

Step 1 (Install the service)

The below commands by the order will install the service, run it and make it run in the startup

sudo yum install samba
sudo service smb start
sudo chkconfig smb on

Step 2 (Create the sharing directory and the users)

Create a folder and name it as an example samba

sudo mkdir /samba
sudo chmod 777 /samba -R

Now create the users

sudo useradd bob
sudo useradd sally
sudo smbpasswd -a bob
sudo smbpasswd -a sally

Step 3 (Configure smb.conf)

smb.conf is the configuration file for the samba program, you can configure the shares through this file. you will find this file in /etc/samba/ directory. Now open this file with any text editor, in this example I will use the nano editor

sudo nano /etc/samba/smb.conf

Copy and paste the below in the end of the file
[Samba Share]
comment = Shared folder between bob and sally
path = /samba
valid users = bob,sally
admin users = bob
read list = sally
writable = ye
s

Now restart the samba service
sudo service smb restart


In this example we shared the /samba directory and give bob read and write permission and read only permission for sally

Now in the end , in the Microsoft windows machine open run and write the IP address of the server, you will be prompted to write the user name and password.

Congratulation you can now access the shared folder.




No comments:

Post a Comment