Difference between revisions of "Basic SAMBA Configuration"
Jump to navigation
Jump to search
Michael.mast (talk | contribs) (Created page with "==CentOS 8== <ref>https://lintut.com/easy-samba-installation-on-rhel-centos-7/</ref> *Prepare the basic config by installing packages and creating a new config file. <pre> dnf...") |
Michael.mast (talk | contribs) |
||
Line 27: | Line 27: | ||
</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. | ||
+ | *Also add selinux permissions.<ref>https://selinuxproject.org/page/SambaRecipes</ref> | ||
<pre> | <pre> | ||
groupadd group1 | groupadd group1 | ||
Line 33: | Line 34: | ||
chown -R user1:group1 /data/share1 | chown -R user1:group1 /data/share1 | ||
chmod -R 0770 /data/share1 | chmod -R 0770 /data/share1 | ||
+ | semanage fcontext -a -t samba_share_t "/data/share1(/.*)?" | ||
+ | restorecon -R /data/share1 | ||
</pre> | </pre> | ||
*Update the samba config. | *Update the samba config. |
Revision as of 15:50, 10 November 2019
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.
- 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 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