Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Config
Commits
287135f7
Commit
287135f7
authored
Jan 03, 2016
by
Igor Pečovnik
Browse files
samba conf into file, fixes for
https://github.com/thias/puppet-samba/pull/18
parent
94e6bb0b
Changes
2
Show whitespace changes
Inline
Side-by-side
functions.sh
View file @
287135f7
...
...
@@ -335,10 +335,11 @@ debconf-apt-progress -- apt-get -y install transmission-cli transmission-common
install_samba (){
#--------------------------------------------------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------------------------------------------------
-
# install Samba file sharing
#--------------------------------------------------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------------------------------------------------
-
# Read samba user / pass / group
local SECTION="
Samba
"
SMBUSER=
$(
whiptail
--inputbox
"What is your samba username?"
8 78
$SMBUSER
--title
"
$SECTION
"
3>&1 1>&2 2>&3
)
exitstatus=
$?
; if [
$exitstatus
= 1 ]; then exit 1; fi
SMBPASS=
$(
whiptail
--inputbox
"What is your samba password?"
8 78
$SMBPASS
--title
"
$SECTION
"
3>&1 1>&2 2>&3
)
...
...
@@ -350,53 +351,14 @@ debconf-apt-progress -- apt-get -y install samba samba-common-bin
useradd
$SMBUSER
echo -ne "
$SMBPASS
\n
$SMBPASS
\n
" | passwd
$SMBUSER
echo -ne "
$SMBPASS
\n
$SMBPASS
\n
" | smbpasswd -a -s
$SMBUSER
service samba stop
cat > /etc/samba/smb.conf <<"
EOF
"
[global]
workgroup = SMBGROUP
server string = %h server
hosts allow = SUBNET
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
load printers = yes
printing = cups
printcap name = cups
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
public = yes
guest ok = yes
writable = no
printable = yes
printer admin = SMBUSER
[print
$]
comment = Printer Drivers
path = /etc/samba/drivers
browseable = yes
guest ok = no
read only = yes
write list = SMBUSER
[ext]
comment = Storage
path = /ext
writable = yes
public = no
valid users = SMBUSER
force create mode = 0777
force directory mode = 0777
EOF
service samba stop | service smbd stop
cp scripts/smb.conf /etc/samba/smb.conf
sed -i "
s
/SMBGROUP/
$SMBGROUP
/
" /etc/samba/smb.conf
sed -i "
s
/SMBUSER/
$SMBUSER
/
" /etc/samba/smb.conf
sed -i "
s
/SUBNET/
$SUBNET
/
" /etc/samba/smb.conf
mkdir /ext
chmod -R 777 /ext
service samba st
art
service samba st
op | service smbd start >/dev/null 2>&1
}
...
...
scripts/smb.conf
0 → 100644
View file @
287135f7
[
global
]
workgroup
=
SMBGROUP
server
string
= %
h
server
hosts
allow
=
SUBNET
log
file
= /
var
/
log
/
samba
/
log
.%
m
max
log
size
=
1000
syslog
=
0
panic
action
= /
usr
/
share
/
samba
/
panic
-
action
%
d
load
printers
=
yes
printing
=
cups
printcap
name
=
cups
[
printers
]
comment
=
All
Printers
path
= /
var
/
spool
/
samba
browseable
=
no
public
=
yes
guest
ok
=
yes
writable
=
no
printable
=
yes
printer
admin
=
SMBUSER
[
print
$]
comment
=
Printer
Drivers
path
= /
etc
/
samba
/
drivers
browseable
=
yes
guest
ok
=
no
read
only
=
yes
write
list
=
SMBUSER
[
ext
]
comment
=
Storage
path
= /
ext
writable
=
yes
public
=
no
valid
users
=
SMBUSER
force
create
mode
=
0777
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment