Configure Samba on CentOS 6

Installation

yum install samba samba-client samba-common
chkconfig smb on
etc/init.d/smb start

Files

  • Global configuration file: /etc/samba/smb.conf

Commands

  • Check an smb.conf configuration file for internal correctness: testparm
  • Report on current Samba connections: smbstatus
  • List info about machines that respond to SMB name queries on a subnet: findsmb
  • List local shares: smbclient -L localhost
  • List what shares are available from a server: smbclient -U admins -L 192.168.1.32
  • FTP like client to access SMB/CIFS resources on a sercer: smbclient //192.168.1.32/<share> -U daniel
  • Create a samba user:
useradd <username> -s /sbin/nologin
smbpasswd -a <username>
  • Mount a samba share:
mount -t cifs //192.168.1.32/Lacie /Lacie -o username=<username>,password=<password>

or

mount.cifs //192.168.1.32/Lacie /Lacie -o username=<username>,password=<password>      # yum install cifs-utils
  • Add a share in /etc/fstab (yum install cifs-utils):

vi /home/daniel/.smbcredentials

username=daniel
password=password

chmod 600 /home/daniel/.smbcredentials

vi /etc/fstsb

//192.168.1.32/Lacie    /Lacie          cifs    credentials=/root/.smbpasswd 0 0