File Servers¶
Overview¶
- ProFTPD - Simple, efficient, lightweight FTP file server
- Samba - Feature rich file server
- vsftpd - Feature rich FTP file server
- NFS - Network file system server
How do I run DietPi-Software and install optimised software items?
To install any of the DietPi optimised software items listed below run from the command line:
dietpi-software
Choose Browse Software and select one or more items. Finally select Install
.
DietPi will do all the necessary steps to install and start these software items.
To see all the DietPi configurations options, review the DietPi Tools section.
Return to the Optimised Software list
ProFTPD¶
ProFTPD gives you access to files/music/downloads etc. on your DietPi system quickly and efficiently with minimal overhead.
The access to ProFTPD with Windows is achieved as follows:
- Go to My Computer (Windows Explorer).
- In the address bar at the top type
ftp://dietpi:dietpi@192.168.0.100
press enter.
Change 192.168.0.100 to the IP address of your DietPi system.
The access to ProFTPD with an FTP client is achieved as follows:
- Username =
dietpi
- Password = The same as your root login password. Default is
dietpi
- Address = Your IP address (e.g.: 192.168.0.100)
- Port = 21
The destination directory can be changed by replacing /Path/To/Directory to your target directory (within the configuration file /etc/proftpd/proftpd.conf
):
systemctl stop proftpd
sed -i '/DefaultRoot /c\DefaultRoot /Path/To/Directory' /etc/proftpd/proftpd.conf
systemctl start proftpd
Jailing means to lock users to their home folders.
Jailing can be enabled in the configuration file /etc/proftpd/proftpd.conf
via
systemctl stop proftpd
sed -i '/DefaultRoot /c\DefaultRoot ~' /etc/proftpd/proftpd.conf
systemctl start proftpd
Wikipedia: https://wikipedia.org/wiki/ProFTPD
Samba¶
The Samba server lets you share files on your DietPi system with ease based on the well known SMB networking protocol.
The access to the Samba file server is achieved as follows:
- Address =
\\192.168.0.100\dietpi
- Username =
dietpi
- Password =
<your global application password>
(default:dietpi
)
The Samba password can be changed with
smbpasswd -a dietpi
To add/change the valid user do the following steps:
- Edit
/etc/samba/smb.conf
- Search the entry
[dietpi]
, changevalid users = username_i_require
- Add the user to Samba with
smbpasswd -a username_i_require
- Search the entry
- Restart services with
systemctl restart nmbd smbd
You can now connect to the samba server with the username and password you entered above.
The destination directory can be changed by replacing /Path/To/Directory to your target directory (within the configuration file /etc/samba/smb.conf
):
sed -i '/path = /c\path = /Path/To/Directory' /etc/samba/smb.conf
systemctl restart nmbd smbd
In case of problems with the Samba share not showing up in the Windows network view, the wsdd
daemon (Web Service Dynamic Discovery host daemon) can be installed. This is achieved with the following steps:
Install WSDD via APT:
apt install wsdd2
Start the service via:
systemctl start wsdd2
Check the service status via:
systemctl status wsdd2
We use the WSDD2 variant written in C here.
The original WSDD is written in Python, but we prefer the C variant, for less dependencies and RAM usage. In case, you could also use the original variant, where package and service are called wsdd
instead of wsdd2
.
Add the 3rd party repository and install WSDD via APT:
curl -sSfL 'https://pkg.ltec.ch/public/conf/ltec-ag.gpg.key' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-wsdd.gpg --yes
echo "deb https://pkg.ltec.ch/public/ $G_DISTRO_NAME main" > /etc/apt/sources.list.d/dietpi-wsdd.list
apt update
apt install wsdd
Start the service via:
systemctl start wsdd
Check the service status via:
systemctl status wsdd
Wikipedia: https://wikipedia.org/wiki/Samba_(software)
YouTube video tutorial (German language): Raspberry Pi als Datei-Server - einfache Installation eines Fileservers Samba unter DietPi
vsftpd¶
Very secure FTP file server with feature rich security options.
The access to vsftpd with Windows is achieved as follows:
- Go to My Computer (Windows Explorer).
- In the address bar at the top type
ftp://dietpi:dietpi@192.168.0.100
press enter.
Change 192.168.0.100
to the IP address of your DietPi system.
The access to vsftpd with an FTP client is achieved as follows:
- Username =
dietpi
- Password = The same as your root login password. Default is
dietpi
- Address = Your IP address (e.g.: 192.168.0.100)
- Port = 21
The destination directory can be changed by replacing /Path/To/Directory to your target directory (within the configuration file /etc/vsftpd.conf
):
sed -i '/local_root=/c\local_root=/Path/To/Directory' /etc/vsftpd.conf
systemctl restart vsftpd
Wikipedia: https://wikipedia.org/wiki/Vsftpd
NFS¶
Network file system server.
The access to the NFS share with an NFS client is achieved as follows:
- Address = IP address of your DietPi system (e.g.: 192.168.0.100)
- Port = 2049
The NFS access configuration is done via export files.
You can edit the /etc/exports
file as well as adding further export files within the /etc/exports.d
directory.
Explanations of the export file format are available in the internet or can be read in the man pages (use man exports
, therefore the package man needs to be installed).
After changing the access configuration, the export information can be re-read via command
exportfs -ra
Alternatively you can restart the service (systemctl restart nfs-kernel-server
).
The actual access configuration can be displayed with the command
exportfs
On the client side you can query the mountable exports with the command
showmount -e <NFS_SERVER>
By default the DietPi NFS installation exports the directory /mnt/dietpi_userdata
for everyone. This is configured in /etc/exports.d/dietpi.exports
. You can edit this file to restrict the access.
E.g. you could limit the access to the NFS share by setting a IP address range:
- Edit the following file:
/etc/exports.d/dietpi.exports
To only allow users access with an IP address range of 192.168.0.1-255
/mnt/dietpi_userdata 192.168.0.*(rw,async,no_root_squash,fsid=0,crossmnt,no_subtree_check)
Activate the new configuration (
systemctl restart nfs-kernel-server
orexportfs -ra
)