Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fedora - How to set up a TFTP server on Fedora

#1
How to set up a TFTP server on Fedora

<div><p><strong>TFTP</strong>, or Trivial File Transfer Protocol, allows users to transfer files between systems using the <a href="https://en.wikipedia.org/wiki/User_Datagram_Protocol">UDP protocol</a>. By default, it uses UDP port 69. The TFTP protocol is extensively used to support remote booting of diskless devices. So, setting up a TFTP server on your own local network can be an interesting way to do <a href="https://docs.fedoraproject.org/en-US/fedora/f30/install-guide/advanced/Network_based_Installations/">Fedora installations</a>, or other diskless operations.</p>
<p> <span id="more-29278"></span> </p>
<p>TFTP can only read and write files to or from a remote system. It doesn’t have the capability to list files or make any changes on the remote server. There are also no provisions for user authentication. Because of security implications and the lack of advanced features, TFTP is generally only used on a local area network (LAN).</p>
<h2>TFTP server installation</h2>
<p>The first thing you will need to do is install the TFTP client and server packages:</p>
<pre class="wp-block-preformatted">dnf install tftp-server tftp -y</pre>
<p>This creates a <em>tftp</em> service and socket file for <a href="https://fedoramagazine.org/systemd-getting-a-grip-on-units/">systemd</a> under <em>/usr/lib/systemd/system</em>.</p>
<pre class="wp-block-preformatted">/usr/lib/systemd/system/tftp.service
/usr/lib/systemd/system/tftp.socket</pre>
<p>Next, copy and rename these files to <em>/etc/systemd/system</em>:</p>
<pre class="wp-block-preformatted">cp /usr/lib/systemd/system/tftp.service /etc/systemd/system/tftp-server.service cp /usr/lib/systemd/system/tftp.socket /etc/systemd/system/tftp-server.socket</pre>
<h2>Making local changes</h2>
<p>You need to edit these files from the new location after you’ve copied and renamed them, to add some additional parameters. Here is what the <em>tftp-server.service</em> file initially looks like:</p>
<pre class="wp-block-preformatted">[Unit]
Description=Tftp Server
Requires=tftp.socket
Documentation=man:in.tftpd [Service]
ExecStart=/usr/sbin/in.tftpd -s /var/lib/tftpboot
StandardInput=socket [Install]
Also=tftp.socket</pre>
<p>Make the following changes to the <em>[Unit]</em> section:</p>
<pre class="wp-block-preformatted">Requires=tftp-server.socket</pre>
<p>Make the following changes to the <em>ExecStart</em> line:</p>
<pre class="wp-block-preformatted">ExecStart=/usr/sbin/in.tftpd -c -p -s /var/lib/tftpboot</pre>
<p>Here are what the options mean:</p>
<ul>
<li>The <strong><em>-c</em></strong> option allows new files to be created.</li>
<li>The <strong><em>-p</em></strong> option is used to have no additional permissions checks performed above the normal system-provided access controls.</li>
<li>The<strong><em> -s</em></strong> option is recommended for security as well as compatibility with some boot ROMs which cannot be easily made to include a directory name in its request.</li>
</ul>
<p>The default upload/download location for transferring the files is <em>/var/lib/tftpboot</em>.</p>
<p>Next, make the following changes to the <em>[Install]</em> section:</p>
<pre class="wp-block-preformatted">[Install]
WantedBy=multi-user.target
Also=tftp-server.socket</pre>
<p>Don’t forget to save your changes!</p>
<p>Here is the completed <em>/etc/systemd/system/tftp-server.service</em> file:</p>
<pre class="wp-block-preformatted">[Unit]
Description=Tftp Server
Requires=tftp-server.socket
Documentation=man:in.tftpd [Service]
ExecStart=/usr/sbin/in.tftpd -c -p -s /var/lib/tftpboot
StandardInput=socket [Install]
WantedBy=multi-user.target
Also=tftp-server.socket</pre>
<h2>Starting the TFTP server</h2>
<p>Reload the systemd daemon:</p>
<pre class="wp-block-preformatted">systemctl daemon-reload</pre>
<p>Now start and enable the server:</p>
<pre class="wp-block-preformatted">systemctl enable --now tftp-server</pre>
<p>To change the permissions of the TFTP server to allow upload and download functionality, use this command. Note TFTP is an inherently insecure protocol, so this may not be advised on a network you share with other people.</p>
<pre class="wp-block-preformatted">chmod 777 /var/lib/tftpboot</pre>
<p>Configure your firewall to allow TFTP traffic:</p>
<pre class="wp-block-preformatted">firewall-cmd --add-service=tftp --perm
firewall-cmd --reload</pre>
<h2>Client Configuration</h2>
<p>Install the TFTP client:</p>
<pre class="wp-block-preformatted">yum install tftp -y</pre>
<p>Run the <em>tftp</em> command to connect to the TFTP server. Here is an example that enables the verbose option:</p>
<pre class="wp-block-preformatted">[client@thinclient:~ ]$ <strong>tftp 192.168.1.164</strong>
tftp&gt; <strong>verbose</strong>
Verbose mode on.
tftp&gt; <strong>get server.logs</strong>
getting from 192.168.1.164:server.logs to server.logs [netascii]
Received 7 bytes in 0.0 seconds [inf bits/sec]
tftp&gt; <strong>quit</strong>
[client@thinclient:~ ]$ </pre>
<p>Remember, TFTP does not have the ability to list file names. So you’ll need to know the file name before running the <em>get</em> command to download any files.</p>
<hr class="wp-block-separator" />
<p><em>Photo by </em><a href="https://unsplash.com/@laikanotebooks?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText"><em>Laika Notebooks</em></a><em> on <a href="https://unsplash.com/search/photos/file-folders?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></em>.</p>
</div>


https://www.sickgaming.net/blog/2019/09/...on-fedora/
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Fedora - Contribute to Fedora 39 Upgrade, Virtualization, and Cloud Test Day xSicKxBot 0 2,031 09-30-2023, 03:56 AM
Last Post: xSicKxBot
  Fedora - Share your game achievements with Gamerzilla xSicKxBot 0 1,002 09-27-2023, 09:59 AM
Last Post: xSicKxBot
  Fedora - Using Cockpit to graphically manage systems, without installing Cockpit on xSicKxBot 0 895 09-26-2023, 06:41 AM
Last Post: xSicKxBot
  Fedora - Announcing Fedora Linux 39 Beta xSicKxBot 0 917 09-20-2023, 09:48 AM
Last Post: xSicKxBot
  Fedora - Contribute at Passkey Auth, Fedora CoreOS and IoT Test Week xSicKxBot 0 890 09-19-2023, 12:23 PM
Last Post: xSicKxBot
  Fedora - Quick Fedora shirt update and sale of last stock with the old logo xSicKxBot 0 942 09-16-2023, 12:28 PM
Last Post: xSicKxBot
  Fedora - Contribute at the Fedora Linux Test Week for Kernel 6.5 and Toolbx Test Day xSicKxBot 0 950 09-11-2023, 02:47 PM
Last Post: xSicKxBot
  Fedora - Fedora Linux Flatpak cool apps to try for September xSicKxBot 0 931 09-10-2023, 04:59 PM
Last Post: xSicKxBot
  Fedora - Contribute at the Test Week for the Anaconda WebUI Installer for Fedora Wor xSicKxBot 0 923 09-09-2023, 11:54 PM
Last Post: xSicKxBot
  Fedora - Docs workshop: Virtually writing together xSicKxBot 0 967 09-09-2023, 05:08 AM
Last Post: xSicKxBot

Forum Jump:


Users browsing this thread:
2 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016