Difference between revisions of "TFTP"

From ArchWiki
Jump to: navigation, search
(Configuration)
m (Run)
(6 intermediate revisions by 2 users not shown)
Line 8: Line 8:
  
 
== Configuration ==
 
== Configuration ==
The configuration for tftpd is in {{ic|/etc/conf.d/tftpd}}
 
  
The default configuration is:
+
Create a copy of the {{ic|tftpd.service}} unit, and modify {{ic|ExecStart}} with the appropriate directory to use as the tftp root.
#
+
# Parameters to be passed to TFTPD
+
#
+
TFTPD_ARGS="-l -s /srv/tftp/"
+
  
or {{ic|/usr/lib/systemd/system/tftpd.service}} for systemd configuration.
+
{{hc|# vim /etc/systemd/system/tftpd.service|2=
 +
[Unit]
 +
Description=hpa's original TFTP daemon
  
[Unit]
+
[Service]
Description=hpa's original TFTP daemon
+
ExecStart=/usr/sbin/in.tftpd -s /srv/tftp/
+
StandardInput=socket
[Service]
+
StandardOutput=inherit
ExecStart=/usr/sbin/in.tftpd -s /srv/tftp/
+
StandardError=journal}}
StandardInput=socket
+
StandardOutput=inherit
+
StandardError=journal
+
  
The directory {{ic|/srv/tftp}} is created automatically when {{Pkg|tftp-hpa}} is installed.
+
[[Systemd#Replacing_provided_unit_files]] talks in more detail about customizing unit files.
 
+
For a complete list of parameters:
+
$ man in.tftpd
+
  
 
== Run ==
 
== Run ==
  
=== Systemd ===
+
Start tftpd:
To start the daemon at boot, run:
+
# systemctl enable tftpd.socket
+
  
 +
# systemctl start tftpd.socket tftpd.service
  
To start the daemon manually (You must respect this order):
+
To start tftpd on boot:
# systemctl start tftpd.socket
+
# systemctl start tftpd.service
+
  
 +
# systemctl enable tftpd.socket
  
To stop the daemon manually (You must respect this order):
+
See [[Systemd#Using_units]] for more information on manipulating services.
# systemctl stop tftpd.socket
+
# systemctl stop tftpd.service
+
 
+
=== Sysvinit ===
+
To start the daemon at boot, add {{ic|tftpd}} to the {{ic|DAEMONS}} array in {{ic|/etc/[[rc.conf]]}}.
+
 
+
To start the daemon manually:
+
# /etc/rc.d/tftpd start
+
 
+
To start the daemon without a configuration file:
+
# /usr/sbin/in.tftpd -l -s path/to/folder/to/export
+
 
+
== Troubleshooting ==
+
=== tftpd startup fails if ipv6 is disabled ===
+
If tftpd startup fails without leaving error messages, it might be because ipv6 is disabled and you are not explicitly telling tftpd not to use ipv6. You can make tftpd start by enabling ipv6 or by telling tftpd to only use ipv4, adding the '-4' switch to /etc/conf.d/tftpd
+
 
+
{{hc|/etc/conf.d/tftpd|<nowiki>
+
TFTPD_ARGS="-l -4 -s /srv/tftp/"
+
</nowiki>}}
+

Revision as of 06:44, 6 February 2013

The Trivial File Transfer Protocol (TFTP) provides a minimalistic means for transferring files. It is generally used as a part of PXE booting or for updating configuration and firmware on devices which have limited memory such as routers and printers.

This article describes how to set up a tftpd server under Arch Linux using the tftp-hpa package.

Installation

Install the package tftp-hpa which can be found in the official repositories.

Configuration

Create a copy of the tftpd.service unit, and modify ExecStart with the appropriate directory to use as the tftp root.

# vim /etc/systemd/system/tftpd.service
[Unit]
Description=hpa's original TFTP daemon

[Service]
ExecStart=/usr/sbin/in.tftpd -s /srv/tftp/
StandardInput=socket
StandardOutput=inherit
StandardError=journal

Systemd#Replacing_provided_unit_files talks in more detail about customizing unit files.

Run

Start tftpd:

# systemctl start tftpd.socket tftpd.service

To start tftpd on boot:

# systemctl enable tftpd.socket

See Systemd#Using_units for more information on manipulating services.