In this guide I will hopefully teach you how to setup samba on centos 6.
install samba, mine was about 18 M
yum install samba
cd /etc/sysconfig
create a share username and password
useradd shareuser -s /sbin/nologin
Now you need to create a password for your user, please note that you must be root to do this command and if you are not in root the terminal will not correct you and instead display a message telling you the optional commands.
smbpasswd –a shareuser
you will be prompted twice to type in the password, please do so
now, we need a folder for it, for this we can create one in the root directory
mkdir /share
by creating this directory as root it only has default root ownership so we must change the ownership.
chown –R shareuser:root /share
we are going to be altering a config file, so it is a good idea to always save a backup
cp /etc/samba/smb.conf /home/<my user name>/smb_20130321_1
we alter the samba configuration file
nano /etc/samba/smb.co
Scroll to the very bottom of the file and add this code:
#my code that I added 2013_03_21
[share]
comment = Share
path = /share
writable = yes
valid users = shareuser
After saving this you can leave root and start the service:
service smb start
now, we can test it to make sure its operating, type
testparm
you should get something like this, and a prompt asking you to push enter
load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section “[homes]”
Processing section “[printers]”
Processing section “[share]”
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
After pushing enter you will see some share folders and be allowed to type new commands
You have a choice, you can decided to have the user get this automatically on boot or require them to get it on login or require them to start the service manually. I am displaying the information for how to make it appear on bootup
chkconfig –levels 235 smb on
if you wish for them to do it manually have them type:
service smb start
while you are here it is a good idea to get your ip address so you can setup other computers to talk on the samba
sudo /usr/sbin/ifconfig
Now we need to configure the firewall
Go to the iptables directory
cd /etc/sysconfig
as before copy the file just to be safe
cp /home/<Your Name Here>/iptables_2013_03_21
now, edit the file
nano iptables
-A INPUT -m udp -p udp –dport 137 -j ACCEPT
-A INPUT -m udp -p udp –dport 138 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 139 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 445 -j ACCEPT
you may want to restart the service again
service smb restart
References:
http://www.krizna.com/centos/installing-configuring-samba-centos-6/