Setting Up NFS and TFTP Services on Ubuntu
Network File System (NFS) Configuration
Install the required NFS server packages:
sudo apt install nfs-kernel-server nfs-commonCreate a directory to act as the shared resource:
sudo mkdir -p /srv/nfs_shareDefine the access rules in the configuration file:
sudo nano /etc/exports
# Append the following line to grant read/write access to a specific subnet
/srv/nfs_share 10.0.0.0/24(rw,sync,no_root_squash,no_subtree_check)Apply the new export settings and verify the active configuration:
sudo exportfs -rav
sudo exportfs -vTrivial File Transfer Protocol (TFTP) Configuration
To avoid timeout issues associated with older xinetd setups, utilize the standalone tftpd-hpa daemon directly. Install the necessary packages:
sudo apt install tftpd-hpa tftp-hpaModify the default configuration to specify the target directory and enable file creation:
sudo nano /etc/default/tftpd-hpa
# Update the configuration as follows:
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp_root"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure --create"Establish the designated directory, assign the appropriate ownership, and set the required permissions:
sudo mkdir -p /srv/tftp_root
sudo chown -R tftp:tftp /srv/tftp_root
sudo chmod -R 775 /srv/tftp_rootRestart the service to apply changes:
sudo systemctl restart tftpd-hpaValidate the connection by retrieving a test file:
tftp localhost
tftp> get test_kernel.img
tftp> quit