TFTP Server On Linux - Deathraymind/ARUBA205 GitHub Wiki
TFTP Server Setup on Linux using Tftpd-hpa
This documentation provides step-by-step instructions for setting up a TFTP (Trivial File Transfer Protocol) server on a Linux system using the Tftpd-hpa package. TFTP is commonly used for network booting and transferring files between devices.
Step 1: Install Tftpd-hpa
-
Open a terminal window on your Linux machine.
-
Install the Tftpd-hpa package using the following command:
sudo apt-get install tftpd-hpa
If you're using a different Linux distribution, use its package manager to install Tftpd-hpa.
Step 2: Configure Tftpd-hpa
-
Edit the Tftpd-hpa configuration file located at
/etc/default/tftpd-hpa
using your preferred text editor. In this example, we'll use thenano
text editor:sudo nano /etc/default/tftpd-hpa
-
Inside the configuration file, configure the following options:
# /etc/default/tftpd-hpa TFTP_USERNAME="tftp" TFTP_DIRECTORY="/tftp" TFTP_ADDRESS=":69" TFTP_OPTIONS="--secure --create"
TFTP_USERNAME
: Set the TFTP server's username, which is typically "tftp."TFTP_DIRECTORY
: Specify the directory from which TFTP will serve files. In this example, we've set it to/tftp
.TFTP_ADDRESS
: Specify the TFTP server's listening address and port. The default port is 69.TFTP_OPTIONS
: Configure any additional TFTP options. In this example, we use--secure
to enable security checks and--create
to allow file creation.
-
Save the changes and exit the text editor.
Step 3: Create the TFTP Directory
-
Create the directory specified in the
TFTP_DIRECTORY
variable. In this example, we use/tftp
:sudo mkdir -p /tftp
Step 4: Set Permissions
-
Adjust the permissions on the TFTP directory to ensure that files can be read and written by the TFTP server:
sudo chown -R nobody:nogroup /tftp
sudo ufw allow 69
To move the files to the /tftp directory use this command
mv ArubaInstant_Taurus_6.5.4.25_86114 /tftp
Step 5: Restart Tftpd-hpa
-
After configuring and creating the TFTP directory, restart the Tftpd-hpa service to apply the changes:
sudo systemctl restart tftpd-hpa
Step 6: Test the TFTP Server
-
To test your TFTP server, you can use a TFTP client. In this example, we use the
tftp
command to test it locally:tftp localhost
-
Within the TFTP client, you can use the
get
andput
commands to retrieve or send files to the TFTP server:-
To retrieve a file from the TFTP server:
tftp> get testfile.txt
-
To send a file to the TFTP server:
tftp> put testfile.txt
Replace
localhost
with the IP address or hostname of your TFTP server if you're testing from a different machine. Ensure that the file you're trying to retrieve or send exists in the TFTP directory. -
Step 7: Managing File Permissions
-
To avoid errors, ensure that the file you add to the TFTP directory has appropriate permissions. You can use the following command to set permissions on a specific file, for example,
file.bin
:sudo chmod 666 /tftp/file.bin
Your TFTP server is now set up and ready to serve files. You can use it for tasks such as network booting or transferring configuration files to network devices.