-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathsamba-init.sh
42 lines (38 loc) · 959 Bytes
/
samba-init.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
#!/bin/bash
#If a USB drive is present, do not initialize the samba share
USBDisk_Present=`sudo fdisk -l | grep /dev/sd`
if [ -n "${USBDisk_Present}" ]
then
echo "exited to due to presence of USB storage"
exit
fi
#if /usr/local/bin/ps3netsrv++ exists
if [ -f /usr/local/bin/ps3netsrv++ ]; then
#restart ps3netsrv++
pkill ps3netsrv++
/usr/local/bin/ps3netsrv++ -d /share
fi
sudo cat <<'EOF' | sudo tee /etc/samba/smb.conf
[global]
server min protocol = NT1
workgroup = WORKGROUP
usershare allow guests = yes
map to guest = bad user
allow insecure wide links = yes
[share]
Comment = shared folder
Path = /share
Browseable = yes
Writeable = Yes
only guest = no
create mask = 0777
directory mask = 0777
Public = yes
Guest ok = yes
force user = userplaceholder
follow symlinks = yes
wide links = yes
EOF
#if you wish to create a samba user with password you can use the following:
#sudo smbpasswd -a userplaceholder
sudo /etc/init.d/smbd restart