2015-10-15

[SOLVED]SAMBA FOR CENTOS/UBUNTU SERVER

#12:29 17/06/2015
##################
yum install samba samba-client samba-common cifs-utils
nano /etc/samba/smb.conf

############################################################SAMBA CONFIG:BEGIN
######SMB CONFIG START HERE#####
[global]
workgroup = WORKGROUP
interfaces = lo eth0 eth1 2.2.2.0/24
hosts allow = 127. 2.2.2.148 2.2.2.152
server string = Samba Server %v
netbios name = centos
security = user
map to guest = bad user
dns proxy = no
client smbuser_opt_gluster_server auth = yes
printing = bsd
printcap name = /dev/null
################################
#______SHARE DEFINITIONS-FULL PERMISSION
[Anonymous]
path = /samba/anonymous
browsable =yes
writable = yes
guest ok = yes
read only = no
comment = THIS IS ANONYMOUS SHARE, FULL PERMISSION
#______SECURED SHARE-FULL PERMISSION
[secured]
path = /samba/secured
valid users = qwerty,@smbgrp
guest ok = no
writable = yes
browsable = yes
valid users = qwerty
comment = THIS IS SECURED SHARE, FULL PERMISSION
#______SECURED SHARE-READONLY
[gluster-server]
path = /opt/gluster-server
valid users = smbuser_opt_gluster_server,@smbgrp
guest ok = yes
writable = no
browsable = yes
valid users = smbuser_opt_gluster_server
comment = THIS IS SECURED SHARE, READONLY
################################
############################################################SAMBA CONFIG:END

#[root@server1 samba]# groupadd smbgrp
#[root@server1 samba]# useradd smbuser_opt_gluster_server
#[root@server1 samba]# usermod -G smbgrp smbuser_opt_gluster_server
#[root@server1 samba]# smbpasswd -a smbuser_opt_gluster_server
New SMB password: xxx
Retype new SMB password: xxx
Added user smbuser_opt_gluster_server.

#
#From samba server:
smbclient -L //2.2.2.148 -U smbuser_opt_gluster_server

#From remote client:
smbclient -L //2.2.2.148 -U smbuser_opt_gluster_server

#From remote client:
smbclient -L //2.2.2.148/gluster-server -U smbuser_opt_gluster_server

#
mkdir -p /mnt/srv148
cd /mnt/srv148
C2: mount -t cifs //2.2.2.148/gluster-server -o credentials=/opt/script/credentials_srv148.txt /mnt/srv148



/opt/script/credentials_srv148.txt
username=xxx
password=xxx

service smb restart
service nmb restart

smbclient //2.2.2.148/gluster-server -U smbuser_opt_gluster_server

#RESULT:
root@BackupServer:/mnt/srv148/temp-data# ll /mnt/srv148/
total 4
drwxr-xr-x   5 root root    0 Jun 12 21:52 ./
drwxr-xr-x   5 root root 4096 Jun 15 13:01 ../
drw------- 261 root root    0 Jan  7 23:54 .glusterfs/
drwxr-xr-x   3 root root    0 Jun 10 03:41 temp-data/
drwxr-xr-x   8 root root    0 Jan 31 17:40 www/

#DONE !

No comments:

Post a Comment