Warning: Running this script involves risks! It modifies system settings and disks, which can lead to data loss if not used carefully.
Only proceed if you are comfortable with command-line operations and server configuration or are willing to accept potential risks.
Stay tuned for future video tutorials covering these steps in detail!
This script automates the setup of a Linux server (e.g., a Raspberry Pi or other Ubuntu-based system) as a file-sharing server using Samba. It allows you to share files across your network, accessible from Windows, macOS, or Linux devices. Below is a step-by-step explanation of what the script does.
The script checks if it's running with root (administrator) privileges, as some tasks require elevated access. If not run with sudo, it will exit with a warning.
Ensures essential tools (e.g., blkid, samba, ufw) are installed. If any are missing, it prompts you to install them before proceeding.
Checks for an internet connection and updates the server's software to the latest versions for security and stability. If there's no internet, this step is skipped.
Installs required packages if not already present:
samba: For file sharing over the network.ntfs-3g, exfatprogs, dosfstools: For handling various disk file systems (NTFS, exFAT, FAT32).ufw: For firewall configuration.e2fsprogs: For managing ext4 file systems.Detects connected disks (e.g., USB drives) and sets them up for sharing:
/mnt/main or /mnt/secondary1.Configures Samba to share the mounted disks over the network:
Sets up the firewall (ufw) to allow Samba and SSH traffic for secure access. If the firewall is disabled, it asks if you want to enable it.
Creates a script to update the system and reboot safely (only when no users are accessing Samba shares):
/root/cronjobs/updater.sh and adds it to the system's cron jobs.At the end, the script shows:
raspberrypi).192.168.1.100).\\[server name]\[share] or \\[server ip]\[share]smb://[server name]/[share] or smb://[server ip]/[share]smb://[server name]/[share] or smb://[server ip]/[share]Use these paths to connect to the shares from your devices, entering the Samba username and password if prompted.
All actions are logged to /var/log/server_config.log for troubleshooting. Check this file if you encounter issues.
The NAS Setup page provides you with the following command:
cd ~ && wget https://nas.humbertoduenas.com/configure_server.sh && chmod +x configure_server.sh && sudo ./configure_server.sh
What it does: The command navigates to your "home" directory then downloads the configuration script we just described from our website to your home directory. It then makes the script executable so that your machine can run it, then it actually runs it.