Versions
- CentOS 6.4
- Samba 3.6.9
- Windows 7
Install
1 |
sudo yum install samba |
Configure
- Add linux user for samba access:
Note
Substitute $SAMBA_USER for samba username 1sudo useradd $SAMBA_USER - Set linux user password:
1sudo passwd $SAMBA_USER
- Add linux user to samba (use same password)
12sudo smbpasswd -a $SAMBA_USERsudo smbpasswd -e $SAMBA_USER
- Optional: Add a path to share and change ownership to samba user:
Note
Substitute $PATH with the absolute path to the directory to share 12mkdir $PATHchown -R $SAMBA_USER:$SAMBA_USER $PATHNotehome directories are shared by the default samba config - Optional: Set selinux context for directory to “samba_share_t” to permit sharing:
1sudo chcon -t samba_share_t $PATH
- Optional: Set selinux bool to make home directories shareable:
1sudo setsebool -P samba_enable_home_dirs on
- Edit /etc/samba/smb.conf and change the workgroup to match the Windows 7 workgroup:
Note
Substitute $WG with the name of the workgroup 1workgroup = $WGNoteif not configured, Windows 7 defaults to the workgroup name “workgroup” - Add the following to the end of /etc/samba/smb.conf:
Note
Substitute $SHARE_NAME with the name of the share 12345[$SHARE_NAME]path = $PATHwriteable = yesbrowseable = yesvalid users = $SAMBA_USER - Start services
12sudo service smb startsudo service nmb start
- Start on boot
12sudo chkconfig smb onsudo chkconfig nmb on
- Open the following ports for samba:
- 137 udp
- 138 udp
- 139 tcp
- 445 tcp
Test
- On Windows 7, open command-line and map drive:
Note
Substitute $HOSTNAME for the hostname of the samba machine, $PASSWORD with the password of the samba user 1net use z: \\$HOSTNAME\$SHARE_NAME /user:$SAMBA_USER $PASSWORDNoteIt may be necessary to run
1net use * /deleteto remove active connections and clear cached connection information if you have attempted to connect to the CentOS machine before.