Saturday, October 6, 2012

Samba Sharing

Samba sharing use for sharing between linux and windows machines

port 137,139,138,445

configuration file /etc/samba/smb.conf

samba sharing can be of two types public and non public with username and passwd

1.public sharing

vim /etc/samba/smb.conf

74 workgroup = MYGROUP
75 server string = Samba Server Version %v

79 interfaces = lo eth0
80 hosts allow = 127. 192.168.12. 192.168.13.

last 8 lines
comment = Public Stuff
path = /smb
public = yes
writable = yes
printable = no
write list = +staff
browseable = no

here work group must be capital
server string is the name by which we select the sambaserver
interfaces as per needed
hosts allowed as per needed
later the share name in square bracket its the name by which we select the samba share from the server
path path to the directory
public yes for the public connection
browseable yes to enable browsing

here we are sharing the /smb directory,we should set the context,sebool and setfacl as need
---->chcon -t samba_share_t /smb
---->setfacl -m u:nobody:rwx /smb
and give needed sebool
getsebool -a | grep smb
getsebool -a | grep samba

2.Non public sharing

for a non public sharing the public tag should be no and we should add following tags from lines 252 to last part

valid users = ram

and we need to setfacl for ram to the directory /smb
---->setfacl -m u:ram:rwx /smb

and we need to give smbpasswd

smbpasswd -a ram
smbpasswd -e ram

-a for adding the user to samba users and -e to enable the samba passwd

we could see the hosted samba server by
smbclient -L <---------IP of server

client part
smbclient -L

smbclient //server_string/sharename

2.Non public users

smbclient //server_string/sharename -U username


  1. Hi there! This blog post couldn't be written any better! Looking through this article reminds me of my previous roommate! He always kept talking about this. I most certainly will forward this post to him. Fairly certain he will have a very good read. I appreciate you for sharing!

  2. You actually make it seem so easy with your presentation but I
    find this matter to be actually something which I think I would
    never understand. It seems too complicated and
    very broad for me. I'm looking forward for your next post, I'll try to get the hang of it!

  3. Its such as yoս learn my thoughts! You appeаr tο grаsp so much about this, like you wrote
    the e bօok in it or somethiոg. I think thɑt you simƿly can
    do with some percent to force the message house a bit, but other tɦan tɦat,
    this is fantastic blog. A fantastic read. I'll definitely be back.

  4. Hurrah, that's what I was seeking for, what a data!
    present here at this website, thanks admin of this web page.

  5. Wow! In the end I got a webpage from where I be able to in fact take
    helpful data concerning my study and knowledge.

  6. Nice post. I was checking continuously this blog and I am impressed!
    Very helpful info specifically the last part :) I care for
    such info a lot. I was seeking this particular info for a long time.
    Thank you and good luck.

  7. Hi, I read your neew stuff daily. Your writinhg style is witty, keep doing what you're doing!

  8. I have read so many articles or reviews concerning the blogger lovers however this piece of writing
    is really a pleasant piece of writing, keep it up.