Assuming you are working somewhere with a small team and you need a local Windows share to collaborate on documents and oder data. A first choice would obviously be to use Dropbox or a similar cloud service. However if you do not want to send your data to another company or if your internet connection is unstable, you might want to use a server in your local network. My suggestion here is the following: Grab yourself a Rapberry PI, configure a Windows compatible Samba share and start using it.
- Purchase a Raspberry PI 3, a power supply, an SD card and preferably an enclosing.
- Write the Raspbian image to the SD card and start the PI.
- Use sudo raspi-config to set the hostname and enable SSH.
- Run sudo apt-get install samba samba-common-bin to install the required packages.
- Create the folder for the share: sudo mkdir -m 1777 /share
/etc/samba/smb.conf as root (sudo!) using vim or nano (according to your taste of Linux editors and append the following block at the bottom.
/etc/samba/smb.conf123456789[share]Comment = PI SharePath = /shareBrowseable = yesWriteable = Yesonly guest = nocreate mask = 0777directory mask = 0777Public = yes
- Restart the samba service: sudo service samba restart
Now you can create the accounts that will be able to use the share:
sudo adduser --no-create-home --disabled-password --disabled-login newuser
sudo smbpasswd -a newuser
sudo service smbd force-reload
You can now access the share using the hostname or the IP address in your windows explorer: \\ip\share
Never trust your users not to mess up things. You should not skip doing backups, especially when it is as easy as this:
- Edit the crontab file:
Add the following line at the bottom to create a backup every hour from 7 to 22.
crontab10 7-22 * * * /home/pi/run-backup.sh
- Create the backup script:
sudo nano /home/pi/run-backup.sh and add the following content.
run-backup.sh12345678FILES="/share/"FOLDER="/home/pi/backups"echo "starting backup of $FILES to $FOLDER"zip -r $FOLDER/share-backup-$(date +"%Y%m%d-%H%M").zip "$FILES"# delete backups older than 3 daysfind $FOLDER -type f -mtime +3 -deleteecho "finished backup"
- Make the script executable: chmod a+x /home/pi/run-backup.sh
Backups are now created every hour as zip files in the folder /home/pi/backups/ .