Thursday, October 1, 2009

CentOS: Install Samba and settings for file sharing

For sharing file in the home or company, I always recommended Samba.

To install Samba under CentOS:

# yum install samba

To start Samba service:

# /sbin/service smb restart

# chkconfig --levels 35 smb  on

To config Samba share folder:

# vi /etc/samba/smb.conf


load printers = No
hosts allow = 127., 192.168.0. #allow intranet IP
workgroup = WORKGROUP

comment = Private Home Directories
read only = No
browseable = No

comment = Public Stuff
path = /home/public
read only = No

path = /home/www
valid users = leo
read only = No
create mask = 0755
browseable = No

To test this conf file:

# testparm

# mkdir /home/public
# chmod -R 777 /home/public

Set up SELinux:

# setsebool -P samba_enable_home_dirs=1
# chcon -R -t samba_share_t /home/public

Setup a new Samba only account's password:

# useradd "username" -d /home/"username" -s /sbin/nologin
# smbpasswd -a "username"

No comments:

Post a Comment