-
Notifications
You must be signed in to change notification settings - Fork 0
/
sambascript.sh
executable file
·58 lines (37 loc) · 1.24 KB
/
sambascript.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
#!/bin/bash
apt install libcups2 samba samba-common
sleep 1
sed -i s/'server role = standalone server'/'security = user\nserver role = standalone server'/g /etc/samba/smb.conf
sleep 1
# /etc/init.d/samba restart
service smdb restart
sleep 1
mkdir /home/linux_comp
sleep 1
chgrp users /home/linux_comp
sleep 1
chmod 775 /home/linux_comp
echo -e '[linux_comp]\n comment pasta publica\n path = /home/linux_comp\n valid users = @users\n force group = users\n create mask = 0660\n directory mask = 0771\n writable = yes' >> /etc/samba/smb.conf
sleep 1
sed -i s/'\;\[homes]'/'[homes]'/g /etc/samba/smb.conf
sleep 1
sed -i s/'\;\ .*comment = Home Directories'/' comment = Home Directories'/ /etc/samba/smb.conf
sleep 1
sed -i s/'\;\ .*browseable = no'/' browseable = no'/ /etc/samba/smb.conf
sleep 1
sed -i s/'\;\ .*create mask = 0700'/' create mask = 0700'/ /etc/samba/smb.conf
sleep 1
sed -i s/'\;\ .*directory mask = 0700'/' directory mask = 0700'/ /etc/samba/smb.conf
sleep 1
sed -i s/'\;\ .*valid users = %S'/' valid users = %S\n writable = yes'/ /etc/samba/smb.conf
sleep 1
# /etc/init.d/samba restart
service smdb restart
useradd guest -m -G users
sleep 1
passwd guest
sleep 1
smbpasswd -a guest
sleep 1
ip -s -c -h a
echo "finalizado"