- #yum install samba
- #service smb restart
- #chkconfig smb on
- #vim /etc/samba/smb.conf
- Line 57 Ensure foll. is there ---> [global]
- Line 74 Put appropriate group name as required. default is workgroup = MYGROUP
- eg. workgroup = REDHAT
- Last Line : Copy last 7 lines and paste it below that, fill/replace as per question.
- eg share name=song, path=/mp3
- [song]
- comment=my collection
- path=/mp3
- public=yes
- writable=yes
- printable=no
- write list=+staff ---->group name
- Then add following so that people can browse it
- browseable=yes
- #service smb restart
- #mkdir /mp3
- Then run following on the client side to verify which share name is available against given IP/hostname
- #smbclient -L <IP address>
- Check the context of the file to be shared
- #ls -ldZ /mp3 ----> default context is default_t
- Change context of the file to be shared
- #chcon -t samba_share_t /mp3
- We can verify it
- in the file /etc/samba/smb.conf ---> Line 40
- #smbclient //localhost/song -U ---> U is for anonymous user
- If not sharing with public user [#vim /etc/samba/smb.conf]
- Remove, public=yes
- Or put, public=no
- valid user = u1, u2, u3
- host allow = 192.168.0.
- save & quit
- Now create samba user
- #useradd -s /sbin/nologin u1
- #useradd -s /sbin/nologin u2
- #useradd -s /sbin/nologin u3
- Assign samba password to user u1, u2, u3
- #smbpasswd -a u1
- #smbpasswd -a u2
- #smbpasswd -a u3
- #service smb restart
- #smbclient -L localhost
- #smbclient //localhost/song -U u1
- Verification
- Now mount it (o=lowercase alphabet o)
- #mount -t cifs -o user=u1 localhost:/ /mnt ----> It will ask password for user u1
- #mount -t cifs -o user=u1%123 localhost:/song /mnt ----> Password for user u1 is mentioned as 123
- #df -h
Thursday, 5 September 2013
Configuring Samba
Labels:
linux,
linux samba,
samba,
samba server
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment