-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsamba-install-deb.sh
69 lines (56 loc) · 1.21 KB
/
samba-install-deb.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
apt update
apt install samba samba-common -y
echo "Please insert shared folder name?"
read fn
mkdir -p /var/$fn
chmod -R 0777 /var/$fn
chown -R nobody:nogroup /var/$fn
mv /etc/samba/smb.conf /etc/samba/smb.conf.ori
echo "Please insert nethbios name?"
read nbn
echo "Please insert workgroup name? (type WORKGROUP for default)"
read wg
echo -n "Do you want to create authentication for access samba shared folder? (y / n) "
read ans
case $ans in
y)
echo "Please insert username?"
read $un
useradd -m -p -s $un
echo "Please insert password?"
read $pass
smbpasswd -a $un
cat > /etc/samba/smb.conf <<EOF
[global]
workgroup = $wg
netbios name = $nbn
security = user
[$fn]
path = /var/$fn
browsable =yes
writable = yes
guest ok = no
read only = no
EOF
;;
n)
cat > /etc/samba/smb.conf <<EOF
[global]
workgroup = $wg
netbios name = $nbn
security = user
map to guest = Bad User
[$fn]
path = /var/$fn
browsable =yes
writable = yes
guest ok = yes
read only = no
force user = nobody
EOF
;;
esac
systemctl restart smbd.service
ufw allow samba
testpar