Friday, September 4, 2015

RHEL7 - Configure smb access

RHEL7 - Configure smb access
Perform following task on your server
1. Share the /smbshared directory via SMB on serverX
2. Set up your SMB server as a member of TESTGROUP workgroup
3. Named your share as netdata
4. Make available the share netdata to example.com domain clients only
5. Set up the share netdata browseable
Now,


- susan must have read access to the share, authenticating with the same password “password”, if necessary
-  Configure the serverX to share /opstack with SMB share name must be cluster.
-  The user frankenstein has readable,writeable,accesseable to the /opstack SMB share.
-  The user martin has read access to the /opstack SMB share.
-  Both users should have the SMB passwd "SaniTago".

yum install samba samba-client

systemctl start smb nmb
systemctl enable smb nmb

firewall-cmd --permanent --add-service=samba
firewall-cmd --reload

mkdir -p /smbshared

semanage fcontext -a -t samba_share_t "/smbshared(/.*)?"
restorecon -Rv /smbshared

setfacl –m u:susan:r-X /smbshared

vi /etc/samba/smb.conf

workgroup = TESTGROUP
[netdata]
comment = netdata share
path = /smbshared
browseable = yes
valid users = susan
read only =yes
hosts allow = 172.25.1. #(ifconfig and get your ip and only use the 3 octets)

grep –i “susan” /etc/passwd(It it return nothing then create a user first)

useradd -s /sbin/nologin susan
smbpasswd -a susan



mkdir –p /opstack

semanage fcontext -a -t samba_share_t "/ opstack (/.*)?"
restorecon -Rv / opstack

vim /etc/samba/smb.conf[cluster]
comment = opstack share
path = /opstack
write list = frankenstein
writable = no

useradd -s /sbin/nologin frankenstein
useradd -s /sbin/nologin martin

smbpasswd –a Frankenstein
smbpasswd –a martin
#Allow Frankenstein write access & Martin read access to the directory
[indent=1]1) setfacl -m u:frankenstein:rwX /opstack/[/indent]
[indent=1]2) setfacl -m u:frankenstein:r-X /opstack/
[/indent]

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
smb multiuser mount.
-  Mount the samba share /opstack permanently beneath /mnt/smbspace on desktopX as a multiuser mount.
-  The samba share should be mounted with the credentials of frankenstein.

# yum –y install cifs-utils samba-client
# mkdir –p /mnt/smbspace

# vi /root/smb-multiuser.txt

username=frankenstein
password= SaniTago

# chmod 0600 /root/multiuser.txt

# vi /etc/fstab
//server1/cluster /mnt/smbspace cifs defaults,sec=ntlmssp,credentials=/root/smb-multiuser.txt,multiuser 0 0 

No comments:

Post a Comment