Difference between revisions of "Basic SAMBA Configuration"
Jump to navigation
Jump to search
Michael.mast (talk | contribs) |
Michael.mast (talk | contribs) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | ==Permission Masking== | ||
+ | <pre> | ||
+ | inherit permissions = yes | ||
+ | create mask = 0770 | ||
+ | #force create mode = 0770 | ||
+ | directory mask = 0770 | ||
+ | #force directory mode = 0770 | ||
+ | unix extensions = no | ||
+ | </pre> | ||
+ | |||
==CentOS 8== | ==CentOS 8== | ||
<ref>https://lintut.com/easy-samba-installation-on-rhel-centos-7/</ref> | <ref>https://lintut.com/easy-samba-installation-on-rhel-centos-7/</ref> | ||
Line 25: | Line 35: | ||
Retype new password: | Retype new password: | ||
passwd: all authentication tokens updated successfully. | passwd: all authentication tokens updated successfully. | ||
+ | smbpasswd -a user1 | ||
+ | New password: | ||
+ | Retype new password: | ||
</pre> | </pre> | ||
*In this example, I want to share a directory with several people. I create a group and add the users to it, then grant this group writes to the directory. | *In this example, I want to share a directory with several people. I create a group and add the users to it, then grant this group writes to the directory. | ||
Line 60: | Line 73: | ||
<pre> | <pre> | ||
sudo yum install samba samba-client samba-common -y | sudo yum install samba samba-client samba-common -y | ||
+ | |||
+ | </pre> |
Latest revision as of 08:03, 22 October 2020
Permission Masking
inherit permissions = yes create mask = 0770 #force create mode = 0770 directory mask = 0770 #force directory mode = 0770 unix extensions = no
CentOS 8
- Prepare the basic config by installing packages and creating a new config file.
dnf install samba samba-client samba-common -y mv /etc/samba/smb.conf /etc/samba/smb.conf.bkp
- Add the following to the file.
[global] workgroup = WORKGROUP server string = MAST_SHARE netbios name = centos security = user map to guest = bad user dns proxy = no #============================ Share Definitions ==============================
- If the users have not been created, create them now.
- Add the users as samba users.
passwd user1 Changing password for user user1. New password: Retype new password: passwd: all authentication tokens updated successfully. smbpasswd -a user1 New password: Retype new password:
- In this example, I want to share a directory with several people. I create a group and add the users to it, then grant this group writes to the directory.
- Also add selinux permissions.[2]
groupadd group1 usermod -a -G group1 user1 usermod -a -G group1 user2 chown -R user1:group1 /data/share1 chmod -R 0770 /data/share1 setsebool -P samba_export_all_ro=1 samba_export_all_rw=1 semanage fcontext -a -t samba_share_t "/data/share1(/.*)?" restorecon -R /data/share1
- Update the samba config.
[share1] path = /data/share1 valid users = @group1 guest ok = no writable = yes browsable = yes
- Enable services
systemctl enable --now smb.service systemctl enable --now nmb.service
- Update firewall rules
firewall-cmd --permanent --add-service=samba firewall-cmd --reload
Amazon Linux 2
sudo yum install samba samba-client samba-common -y