This guide provides a secure method to automatically deploy an unRAID keyfile during boot using a Raspberry Pi FTP server. This eliminates SSH key complexities while maintaining security through user isolation and read-only access.
- Raspberry Pi (any model) on same network as unRAID (Needs to be able to communicate with eachother)
- Basic Linux command line knowledge
- unRAID USB boot drive accessible
sudo apt update
sudo apt install vsftpd -ysudo nano /etc/vsftpd.confModify these lines:
anonymous_enable=NO
local_enable=YES
write_enable=NO
chroot_local_user=YES
allow_writeable_chroot=YESsudo adduser --gecos "FTP" ftpkey
sudo mkdir /home/ftpkey/files
sudo chown ftpkey:ftpkey /home/ftpkey/filessudo cp /path/to/your/unraid.key /home/ftpkey/files/keyfile
sudo chown ftpkey:ftpkey /home/ftpkey/files/keyfile
sudo chmod 400 /home/ftpkey/files/keyfilesudo systemctl restart vsftpdnano /boot/config/goAdd this before /usr/local/sbin/emhttp &:
# Wait for network and Pi to be ready
until ping -c1 <Your-Pi-IP> &>/dev/null; do sleep 2; done
# Download keyfile via FTP
curl -s --netrc-file /boot/config/.netrc -o /root/keyfile "ftp://<Your-Pi-IP>/files/keyfile"
# Set permissions
chmod 600 /root/keyfilenano /boot/config/.netrcAdd these lines (replace with your Pi's IP and password):
machine <Your-Pi-IP>
login ftpkey
password YOUR_SECURE_PASSWORD
chmod 600 /boot/config/.netrcFrom unRAID console:
ping <Your-Pi-IP> # Verify Pi reachability
curl -v --netrc-file /boot/config/.netrc -o /tmp/testfile "ftp://<Your-Pi-IP>/files/keyfile"From any network device:
curl -v ftp://<Your-Pi-IP>/files/keyfile -u ftpkey- Reboot both Raspberry Pi and unRAID server
- unRAID should automatically:
- Wait for Pi to become available
- Download keyfile via FTP
- Start array with retrieved keyfile
- User Isolation:
ftpkeyuser has no shell access and restricted to home directory - Read-Only FTP: Server configured with
write_enable=NO - Network Security: All communication stays within local network
- Credential Protection:
.netrcfile has 600 permissions - Keyfile Permissions: Keyfile is stored with 400 permissions on Pi
On Raspberry Pi:
sudo tail -f /var/log/vsftpd.log- Connection Timeouts: Add delay in
gofile:sleep 10 # Extra delay before download - Permission Issues: Verify ownership:
sudo chown -R ftpkey:ftpkey /home/ftpkey/files
- FTP Connection Problems: Test basic FTP access:
ftp <Your-Pi-IP> (login with ftpkey credentials)
Keep monitor/keyboard attached to unRAID for first reboot. If automatic retrieval fails:
- Manually download keyfile:
curl -s --netrc-file /boot/config/.netrc -o /root/keyfile "ftp://<Your-Pi-IP>/files/keyfile" - Start array manually
- Update Password: When changing FTP password, update both:
- Raspberry Pi:
sudo passwd ftpkey - unRAID:
/boot/config/.netrcfile
- Raspberry Pi:
This solution provides a secure, automated keyfile deployment while eliminating SSH key management complexities. The keyfile is only exposed through a restricted FTP user with no shell access, and transfers occur entirely within your local network.