Add Samba

This commit is contained in:
Dmitri Popov
2019-05-11 12:00:55 +02:00
parent 775186f77a
commit 30228215fa
3 changed files with 40 additions and 5 deletions

View File

@@ -50,11 +50,11 @@ The exact steps depend on the backup mode.
1. Point the browser to *http://127.0.0.1:8000* (replace *127.0.0.1* with the actual IP address of the Raspberry Pi).
2. Start the desired action by pressing the appropriate button.
The access the contents of the storage device, plug it into the Raspberry Pi and press the **DLNA SERVER** button. You can then use a uPnP application on any device on the same network to browse and view the contents of the storage device.
The access the contents of the storage device, plug it into the Raspberry Pi and press the **DLNA & SAMBA** button. You can then use a uPnP or Samba client on any device on the same network to browse and view the contents of the storage device.
<img src="img/rc.png" alt="" />
Activating the DLNA server also returns the disk space usage information. You can use this information to monitor the remaining free space on the storage device.
Activating the DLNA and Samba servers also returns the disk space usage information. You can use this information to monitor the remaining free space on the storage device.
The **System info** link gives you access to basic system information, such as a list of storage devices and memory usage.

View File

@@ -25,7 +25,7 @@ echo "-----------------------------------"
echo "Installing the required packages..."
echo "-----------------------------------"
sudo apt install acl git-core screen rsync exfat-fuse exfat-utils ntfs-3g gphoto2 libimage-exiftool-perl dialog php minidlna -y
sudo apt install acl git-core screen rsync exfat-fuse exfat-utils ntfs-3g gphoto2 libimage-exiftool-perl dialog php minidlna samba samba-common-bin -y
USER="$1"
@@ -91,6 +91,41 @@ case $CHOICE in
;;
esac
echo "--------------------"
echo "Configuring Samba..."
echo "--------------------"
pw="raspberry"
(echo $pw; echo $pw ) | sudo smbpasswd -s -a pi
sudo sh -c "echo '### Global Settings ###' > /etc/samba/smb.conf"
sudo sh -c "echo '[global]' >> /etc/samba/smb.conf"
sudo sh -c "echo 'workgroup = WORKGROUP' >> /etc/samba/smb.conf"
sudo sh -c "echo 'wide links = yes' >> /etc/samba/smb.conf"
sudo sh -c "echo 'unix extensions = no' >> /etc/samba/smb.conf"
sudo sh -c "echo 'dns proxy = no' >> /etc/samba/smb.conf"
sudo sh -c "echo '### Debugging/Accounting ###' >> /etc/samba/smb.conf"
sudo sh -c "echo 'log file = /var/log/samba/log.%m' >> /etc/samba/smb.conf"
sudo sh -c "echo 'max log size = 1000' >> /etc/samba/smb.conf"
sudo sh -c "echo 'syslog = 0' >> /etc/samba/smb.conf"
sudo sh -c "echo 'panic action = /usr/share/samba/panic-action %d' >> /etc/samba/smb.conf"
sudo sh -c "echo '### Authentication ###' >> /etc/samba/smb.conf"
sudo sh -c "echo 'security = user' >> /etc/samba/smb.conf"
sudo sh -c "echo 'map to guest = Bad User' >> /etc/samba/smb.conf"
sudo sh -c "echo 'guest account = pi' >> /etc/samba/smb.conf"
sudo sh -c "echo '### Share Definitions ###' >> /etc/samba/smb.conf"
sudo sh -c "echo '[little-backup-box]' >> /etc/samba/smb.conf"
sudo sh -c "echo 'comment = Little Backup Box /media/storage' >> /etc/samba/smb.conf"
sudo sh -c "echo 'path = /media/storage' >> /etc/samba/smb.conf"
sudo sh -c "echo 'browseable = yes' >> /etc/samba/smb.conf"
sudo sh -c "echo 'force user = pi' >> /etc/samba/smb.conf"
sudo sh -c "echo 'force group = pi' >> /etc/samba/smb.conf"
sudo sh -c "echo 'admin users = pi' >> /etc/samba/smb.conf"
sudo sh -c "echo 'writeable = yes' >> /etc/samba/smb.conf"
sudo sh -c "echo 'read only = no' >> /etc/samba/smb.conf"
sudo sh -c "echo 'guest ok = yes' >> /etc/samba/smb.conf"
sudo sh -c "echo 'create mask = 0777' >> /etc/samba/smb.conf"
sudo sh -c "echo 'directory mask = 0777' >> /etc/samba/smb.conf"
sudo samba restart
echo "---------------------------------------------"
echo "All done! The system will reboot in 1 minute."
echo "---------------------------------------------"

View File

@@ -41,10 +41,10 @@
<button name="camerabackup">Camera backup</button>
</form>
</p>
<p>Activate the DLNA server</p>
<p>Activate the DLNA and Samba servers</p>
<p>
<form method="post">
<button name="minidlna">DLNA server</button>
<button name="minidlna">DLNA & SAMBA</button>
</form>
</p>
<p class="left">Shut down the Little Backup Box</p>