Difference between revisions of "Samba File Server CentOS 7"
Jump to navigation
Jump to search
Line 54: | Line 54: | ||
writeable = yes | writeable = yes | ||
browseable = yes | browseable = yes | ||
− | + | # force createmode=0640 | |
− | + | # force directorymode=0750 | |
− | + | create mask = 660 | |
− | + | directory mask = 770 | |
− | + | inherit acls = Yes # Used for windows simulation, set to "no"(default) if not needed | |
− | valid users = @"MYDOMAIN\domain users" @"MYDOMAIN\server administrators" | + | valid users = @"MYDOMAIN\domain users" @"MYDOMAIN\server administrators" # @ denotes a group |
``` | ``` | ||
Revision as of 21:04, 10 May 2020
Use winbind for samba if using as fileserver as sssd still has home id map limits and issues
Install
#!/usr/bin/env bash set -e # https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-file_and_print_servers#the_samba_services yum install -y realmd oddjob-mkhomedir oddjob samba-winbind-clients \ samba-winbind samba-common-tools yum install -y samba # To share directories yum install -y samba-winbind-krb5-locator mv /etc/samba/smb.conf /etc/samba/smb.conf.orig realm join --membership-software=samba --client-software=winbind MYDOMAIN.com -U busk systemctl start smb systemctl enable smb
Login to host via ssh
ssh from powershell 10.x.x.x
Note how directory is autocreated with /home/myuser@MYDOMAIN
File Sharing
mkdir /jtest echo "test file for samba" > /jtest/example.txt chown "MYDOMAIN\busk":"MYDOMAIN\Domain Users" /jtest/example.txt firewall-cmd --permanent --add-port=445/tcp firewall-cmd --reload setenforce 1 getenforce vim /etc/selinux/config
We are disabling selinux in order to share outside of home directory, modify sepolicy if you want to keep it enabled.
/etc/samba/smb.conf
# have user use id command to get AD group mappings [jtest] path = /jtest read only = no writeable = yes browseable = yes # force createmode=0640 # force directorymode=0750 create mask = 660 directory mask = 770 inherit acls = Yes # Used for windows simulation, set to "no"(default) if not needed valid users = @"MYDOMAIN\domain users" @"MYDOMAIN\server administrators" # @ denotes a group
Some tests
getent passwd MYDOMAIN\busk getent group "MYDOMAIN\Domain Users" chown "MYDOMAIN\busk":"AD\Domain Users" /srv/samba/example.txt
kinit busk@MYDOMAIN.COM
\10.x.x.x\jtest
yum install -y tcpdump tcpdump -nnpli ens192 not port 22 ```