Last active
January 5, 2019 08:19
-
-
Save designer2k2/cdaf6b472975516c0b4d496d9755f19d to your computer and use it in GitHub Desktop.
Install samba on a Raspberry Pi with sharing root config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#this bash script installs samba sharing / and gives it to the pi user | |
apt-get update # To get the latest package lists | |
apt-get install samba samba-common-bin -y | |
#set pi password: | |
(echo raspberry; echo raspberry) | smbpasswd -a pi | |
#restart samba to ensure config is present | |
service smbd restart | |
service nmbd restart | |
#check if config is already ok: | |
if grep -q "\[root\]" /etc/samba/smb.conf; | |
then | |
echo smb.conf already found | |
else | |
echo add block to smb.conf | |
echo -e "[root]\n comment=root\n path=/\n browsable=yes\n writeable=yes\n valid users=pi\n only guest=no" >> /etc/samba/smb.conf | |
echo -e " create mask=07777\n directory mask=07777\n public = no\n force user = root" >> /etc/samba/smb.conf | |
fi | |
#restart samba: | |
service smbd restart | |
service nmbd restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment