Skip to content

SAMBA – Home Directory Shares Made Easy

Q. What is SAMBA?
A. “Samba is a Free Open Source Software suite that provides seamless file and print services to SMB/CIFS clients.”

Q. Where is SAMBA’s home?
A. http://www.samba.org

Q. Why did you bother writing this?
A. Several reasons, mostly to help myself and others.

Note: You may want to copy/paste this into a txt file for easier reading.

---------------------------------------------
This “entry level” guide will show you how to configure SAMBA in order to let users
browse their home folders under Linux via Windows.

Please note: I write these guides under RHEL/CentOS. However, they should work under any distribution. You still may need to tweak things a little. ;0)

I’m also assuming you have sudo rights. You shouldn’t work from root!

---------------------------------------------
If you’ve installed the default settings for SELinux, it will be in “Enforcing” mode.

# To check your SELinux status. (1 = Enforcing, 0 = Permissive)

[[code]]czozMDpcInNoZWxsJmd0OyAvdXNyL3NiaW4vZ2V0ZW5mb3JjZVwiO3tbJiomXX0=[[/code]]

# If you wish to change the state from Enforcing to Permissive temporarily

[[code]]czozNzpcInNoZWxsJmd0OyBzdWRvIC91c3Ivc2Jpbi9zZXRlbmZvcmNlIDBcIjt7WyYqJl19[[/code]]

If you wish to change it permanently between reboots, alter the /etc/selinux/config file to say Permissive
If you wish to keep using SELinux, I’ll provide the extra step to work with this guide,
other wise just ignore the SELinux “setsebool” command.

NOTE: Review the /etc/samba/smb.conf for addtional SELinux settings.
---------------------------------------------
# Install the SAMBA server.

[[code]]czozMjpcInNoZWxsJmd0OyBzdWRvIHl1bSBpbnN0YWxsIHNhbWJhXCI7e1smKiZdfQ==[[/code]]

# Add a user for testing the SMB/CIFS Shared Home directory.

[[code]]czo3MDpcInNoZWxsJmd0OyBzdWRvIC9zYmluL3VzZXJhZGQgc2FtYmF0ZXN0CnNoZWxsJmd0OyBzdWRvIHBhc3N3ZCBzYW1iYXRlc3R7WyYqJl19XCI7e1smKiZdfQ==[[/code]]

# Configure the user “sambatest” smb password.

[[code]]czozNzpcInNoZWxsJmd0OyBzdWRvIHNtYnBhc3N3ZCAtYSBzYW1iYXRlc3RcIjt7WyYqJl19[[/code]]

# Backup the /etc/samba/smb.conf file prior to any changes.
# Edit the smb.conf file and set your “workgroup” / “netbios name” if needed.

[[code]]czoxMTI6XCIKc2hlbGwmZ3Q7IGNkIC9ldGMvc2FtYmEKc2hlbGwmZ3Q7IHN1ZG8gY3AgLS1wcmVzZXJ2ZT1jb250ZXh0IHNtYi5jb257WyYqJl19ZiBzbWIuY29uZi5vcmcKc2hlbGwmZ3Q7IHN1ZG8gdmltIHNtYi5jb25mClwiO3tbJiomXX0=[[/code]]

workgroup = workgroup (this is Windows default group)
netbios name = CENTOS (don’t forget to uncomment this line)

# Set the SMB daemon to start on boot up. (for levels 2345)

 [[code]]czozNzpcInNoZWxsJmd0OyBzdWRvIC9zYmluL2Noa2NvbmZpZyBzbWQgb25cIjt7WyYqJl19[[/code]]

# Start the SAMBA daemon.

 [[code]]czozODpcInNoZWxsJmd0OyBzdWRvIC9zYmluL3NlcnZpY2Ugc21iIHN0YXJ0XCI7e1smKiZdfQ==[[/code]]

# OPTIONAL (if using SELinux)

[[code]]czo2MzpcInNoZWxsJmd0OyBzdWRvIC91c3Ivc2Jpbi9zZXRzZWJvb2wgLVAgc2FtYmFfZW5hYmxlX2hvbWVfZGlycyBvblwiO3tbJiomXX0=[[/code]]

---------------------------------------------
# You’ll want to edit your iptables/firewall rules to allow connections.
# I would recommend locking this down to local network hosts etc.
# I’ll assume your trusted hosts are on a 192.168.1.0/24 network.

[[code]]czoxMTY6XCIKc2hlbGwmZ3Q7IGNkIC9ldGMvc3lzY29uZmlnCnNoZWxsJmd0OyBzdWRvIGNwIC0tcHJlc2VydmU9Y29udGV4dCBpcHR7WyYqJl19YWJsZXMgaXB0YWJsZXMub3JnCnNoZWxsJmd0OyBzdWRvIHZpbSBpcHRhYmxlcwpcIjt7WyYqJl19[[/code]]
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp -s 192.168.1.0/24 --dport 137 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp -s 192.168.1.0/24 --dport 138 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp -s 192.168.1.0/24 --dport 139 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp -s 192.168.1.0/24 --dport 445 -j ACCEPT

---------------------------------------------
# From Windows, browse your “workgroup” network and you should now see “CENTOS”
# Simply log in with the account/smbpasswd you’ve created.

---------------------------------------------
Additional Info:

* Official Samba 3.2.x HOWTO and Referencehttp://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/

* SELinux Guidehttp://docs.fedoraproject.org/selinux-user-guide/f10/en-US/
Copying / Moving files and retaining SELinux Contexts – See section “5.10. Maintaining SELinux Labels ”

* Dan Walsh’s SAMBA / SELinux infohttp://danwalsh.livejournal.com/14195.html

* IPTables
https://help.ubuntu.com/community/IptablesHowTo
http://fedorasolved.org/Members/kanarip/iptables-howto

Published inLinuxRedHat

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *