Posted by : Unknown Saturday, January 9, 2016

Samba Just Magic
what is SAMBA
As the front page at samba.org says, "Samba is an Open Source/Free Software suite that provides seamless file and print services toSMB/CIFS clients." Samba is freely available, unlike other SMB/CIFS implementations, and allows for interoperability between Linux/Unixservers and Windows-based clients.
=====

Section-1:
Configuring smb client:
1. You don't need to configure any client to use smb.
2. smb-client package is installed by default.
3. To view the shares of a machine type
smbclient -L ip-or-hostname -U username
Example: smbclient -L 192.168.100.254 -U student
4. To mount a samba share
mount.cifs //target/sharename /mounting_directory -o user=username
Example: mount.cifs //192.168.100.254/share /mountsmb -o user=student
[assuming that the target server is 192.168.100.254, the sharename is share, the mounting directory is /mountsmb and the user is student]
enter the password for the user student
ls /mountsmb
you should see the contents of the share in the /mountsmb directory.

Section-2: SAMBA Server
Configuring samba share:
1. Package name = samba4
2. yum install samba4*
if you get any error
yum erase samba*
then again yum install samba4*
[ if you cannot erase samba then type yum install samba-*]
3. Configure firewall to allow smb traffic
iptables -I INPUT -p tcp --dport 137 -j ACCEPT
iptables -I INPUT -p udp --dport 137 -j ACCEPT
iptables -I INPUT -p tcp --dport 138 -j ACCEPT
iptables -I INPUT -p udp --dport 138 -j ACCEPT
iptables -I INPUT -p tcp --dport 445 -j ACCEPT
iptables -I INPUT -p udp --dport 445 -j ACCEPT
iptables -I INPUT -p tcp --dport 139 -j ACCEPT
iptables -I INPUT -p udp --dport 139 -j ACCEPT
4. service iptables save
5. service iptables restart
6. create directories which you want to share or use existing directory
here we are creating a directory
mkdir /newshare
cd /newshare
touch file1 file2 file3
7. create a user to access smb share or use existing user
here we are creating a new user
useradd smbuser
passwd smbuser
smbpasswd -a smbuser [ if you use existing user then only this command would be enough]
8. vim /etc/samba/smb.conf
#find the line starts with "workgroup=mygroup"
change the mygroup to WORKGROUP
#fine the line starts with "host allow="
remove the semicolon (;) and modify the line to add the networks you want to give access to
#Now go to the last line of the file and insert a new line
[sharename]
comment = any comment
path = /path-of-the-share-directory
browseable = yes
writable = yes
printable = yes
valid users = username
### and many more options which you have to learn on you own interest###
9. For every share you have to cofigure this file again and again
10. service smb start
11. chkconfig smb on
12. service nmb start
13. chkconfig nmb on
14. service winbind start
15. chkconfig winbind on
16. To check the share
smbclient -L ip -U username
type the password of the user and you should see the shares.
17. Now go to another machine and follow section-1

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Welcome to My Blog

Popular Post

Facebook Page

- Copyright © Configuretion Redhat -Robotic Notes- Powered by Blogger - Designed by bdnet -