Install samba/CIFS server on CentOS

Quags

Administrator
Staff member
On CentOS this installing samba is quick and easy. You can use this as a windows share on another system, for example to backup from your windows server to your CentOS server. Samba can not be run on OpenVZ, just on KVM or Dedicated servers.

1) Install samba

yum -y install samba

2) create a new user. lets call it backup

adduser backup
passwd backup (enter the password twice)

3) Create config file
Edit /etc/samba/smb.conf and remove everything (I delete and edit as new)

Code:
[global]
        browseable = no
        log level = 2
        #socket options = TCP_NODELAY SO_SNDBUF=8192 SO_RCVBUF=8192
        #socket options = SO_RCVBUF=4096 SO_SNDBUF=4096 IPTOS_LOWDELAY TCP_NODELAY SO_KEEPALIVE
        socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_SNDBUF=8576 SO_RCVBUF=8576
        read raw = no
        write raw = no
        dead time = 15
        getwd cache = yes
        large readwrite = no
        read size = 2048





# backup
[backup]
     path = /home/backup
     guest ok = no
     public = no
     writable = yes
     valid users = backup
4) Set a password for samba user backup

smbpasswd -a backup

5) Load CIFS module with
modprobe cifs


6) Restart samba
/etc/init.d/smb restart

You also may want to have it start on boot with
/sbin/chkconfig smb on


That the final step. You can mount this on a windows system using the path

\\your.ipaddress\backup

Username is backup and the password set, from the above example. Your username of course may vary


For security I would firewall off the samba port and allow only known IPs. At minimum have a yum update running daily for security updates.
 
Top