samba/beta-install.sh

raw link view readme
1
2 yum install firewalld -y
3 systemctl start firewalld
4 systemctl enable firewalld
5 firewall-cmd --permanent --add-service=samba
6 firewall-cmd --reload
7
8 yum install samba -y
9
10 systemctl enable smb nmb
11 systemctl start smb nmb
12
13 sed -E -i.original "s/;([ \t]*)netbios name =.*/ netbios name = beta/" /etc/samba/smb.conf | grep netbios
14 sed -E -i "s/;([ \t]*)interfaces =.*/ interfaces = 10.0.0.0\/8/" /etc/samba/smb.conf
15 sed -E -i "s/;([ \t]*)hosts allow =.*/ hosts allow = 10./" /etc/samba/smb.conf
16 sed -i "/^[ \t]*[#;]/d;/^$/d" /etc/samba/smb.conf
17
18 smbpasswd -a dbetz << EOF
19 hello
20 hello
21 EOF
22
23 groupadd librarian
24 useradd -s /sbin/nologin -G librarian jdoe
25 useradd -s /sbin/nologin -G librarian jsmith
26
27 smbpasswd -a jdoe << EOF
28 hello
29 hello
30 EOF
31
32 smbpasswd -a jsmith << EOF
33 hello
34 hello
35 EOF
36
37 setsebool -P samba_enable_home_dirs 1
38
39 mkdir /var/share
40
41 semanage fcontext -at samba_share_t "/var/share(/.*)?"
42 restorecon -R -v /var/share
43
44 chgrp librarian /var/share
45 chmod 2770 /var/share
46
47 cat >> /etc/samba/smb.conf << EOF
48 [librarian]
49 comment = librarian stuff
50 path = /var/share
51 valid users = @librarian
52 writable = yes
53 EOF
54
55 systemctl reload smb nmb
56