Menu

Installing and configuring samba on centos 6



"Sambais an Open Source/Free Software suite that provides seamless file and print services toSMB/CIFS clients." Samba is freely available, unlike other SMB/CIFS implementations, and allows for interoperability between Linux/Unixservers and Windows-based clients.

Step 1  :  Update yum repositories and packages by typing the below command
[root@localhost ~]# yum update

Step 2  :  Install samba packages along with dependencies using yum

[root@localhost ~]# yum install samba

Samba configuration :

Step 3  :  Create a share username and password .
[root@localhost ~]# useradd shareuser -s /sbin/nologin

Now create samba password for username shareuser using smbpasswd command .

[root@localhost ~]# smbpasswd -a shareuser
New SMB password:****
Retype new SMB password:****
Added user shareuser.

Step 4  :   Create a folder called share in the root directory .

[root@localhost ~]# mkdir /share
and change the ownership for the share folder
[root@localhost ~]# chown -R shareuser:root /share/

Step 5  :   open the file /etc/samba/smb.conf . ( Before editing the file , please copy the file to another location for backup ) . Add the below lines at the bottom of the file .

[share]
comment = Share
path = /share
writable = yes
valid users = shareuser

Step 6 : start samba service
[root@localhost ~]# service smb start

and type this below command to start samba service automatically while booting.
[root@localhost ~]# chkconfig --levels 235 smb on

Samba testing :

Step 7  :  You can check  your configuration by using testparm command
[root@localhost ~]# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[share]"
Loaded services file OK.Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[
global]
workgroup = MYGROUP
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
cups options = raw

[
homes]
comment = Home Directories
read only = No
browseable = No
[printers]
comment = All Printers
path = /var/spool/samba
printable = Yes
browseable = No

[
share]
comment = Share
path = /share
valid users = shareuser
read only = No

You can see your share sections. Here by default home folders of users will be displayed . you can comment the unwanted section using “;” symbol .
For example . you can comment homes section as below and restart the service using  “service smb restart
;[homes]
;
comment = Home Directories
;read only = No
;browseable = No

Now you can access share folder on windows machine by typing \samba-server-ip on run prompt . you can see your share folder after entering username and password.
Example - \\192.168.2.251

About Author:


I am a Linux Administrator and Security Expert with this site i can help lot's of people about linux knowladge and as per security expert i also intersted about hacking related news.TwitterFacebook

Next
Newer Post
Previous
Older Post

0 comments:

Post a Comment

 
Top