Install tftpd on rocky9

From Bitbull Wiki
Revision as of 08:22, 14 October 2024 by Chris (talk | contribs) (Created page with "It's always pain to search trough config. This works with systemd sockets, which is the way you should go. <pre> [root@srv-tftp-01 ~]# getenforce Enforcing [root@srv-tftp-...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

It's always pain to search trough config. This works with systemd sockets, which is the way you should go.


[root@srv-tftp-01 ~]# getenforce 
Enforcing

[root@srv-tftp-01 ~]# rpm -qa | grep ftp
vsftpd-3.0.5-5.el9.x86_64
lftp-4.9.2-4.el9.x86_64
ftp-0.17-89.el9.x86_64

[root@srv-tftp-01 ~]# dnf search tftp
Last metadata expiration check: 1:04:06 ago on Mon Oct 14 08:42:28 2024.
==================================================================================================================== Name & Summary Matched: tftp =====================================================================================================================
tftp.x86_64 : The client for the Trivial File Transfer Protocol (TFTP)
erlang-tftp.x86_64 : TFTP client
syslinux-tftpboot.noarch : SYSLINUX modules in /tftpboot, available for network booting
tftp-server.x86_64 : The server for the Trivial File Transfer Protocol (TFTP)

[root@srv-tftp-01 ~]# dnf install tftp tftp-server
Last metadata expiration check: 1:04:47 ago on Mon Oct 14 08:42:28 2024.
Dependencies resolved.
=======================================================================================================================================================================================================================================================================
 Package                                                           Architecture                                                 Version                                                          Repository                                                       Size
=======================================================================================================================================================================================================================================================================
Installing:
 tftp                                                              x86_64                                                       5.2-38.el9                                                       appstream                                                        32 k
 tftp-server                                                       x86_64                                                       5.2-38.el9                                                       appstream                                                        40 k

Transaction Summary
=======================================================================================================================================================================================================================================================================
Install  2 Packages

Total download size: 72 k
Installed size: 116 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): tftp-server-5.2-38.el9.x86_64.rpm                                                                                                                                                                                               173 kB/s |  40 kB     00:00    
(2/2): tftp-5.2-38.el9.x86_64.rpm                                                                                                                                                                                                      128 kB/s |  32 kB     00:00    
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                  279 kB/s |  72 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                                               1/1 
  Installing       : tftp-5.2-38.el9.x86_64                                                                                                                                                                                                                        1/2 
  Installing       : tftp-server-5.2-38.el9.x86_64                                                                                                                                                                                                                 2/2 
  Running scriptlet: tftp-server-5.2-38.el9.x86_64                                                                                                                                                                                                                 2/2 
  Verifying        : tftp-server-5.2-38.el9.x86_64                                                                                                                                                                                                                 1/2 
  Verifying        : tftp-5.2-38.el9.x86_64                                                                                                                                                                                                                        2/2 

Installed:
  tftp-5.2-38.el9.x86_64                                                                                                         tftp-server-5.2-38.el9.x86_64                                                                                                        

Complete!

[root@srv-tftp-01 ~]# firewall-cmd --permanent --add-service tftp
success
[root@srv-tftp-01 ~]# systemctl restart firewalld


[root@srv-tftp-01 ~]# systemctl status tftp
● tftp.service - Tftp Server
     Loaded: loaded (/usr/lib/systemd/system/tftp.service; indirect; preset: disabled)
     Active: active (running) since Mon 2024-10-14 09:51:41 CEST; 2min 23s ago
TriggeredBy: ● tftp.socket
       Docs: man:in.tftpd
   Main PID: 632778 (in.tftpd)
      Tasks: 1 (limit: 23173)
     Memory: 176.0K
        CPU: 14ms
     CGroup: /system.slice/tftp.service
             └─632778 /usr/sbin/in.tftpd -s /var/lib/tftpboot

Oct 14 09:51:41 srv-tftp-01.mybuehl.local systemd[1]: Started Tftp Server.

[root@srv-tftp-01 ~]# setsebool -P tftp_anon_write 1



[root@srv-tftp-01 ~]# grep -- -s /etc/systemd/system/tftp.service 
ExecStart=/usr/sbin/in.tftpd -s /var/lib/tftpboot
[root@srv-tftp-01 ~]# sed -i 's/-s /-c -s /' /etc/systemd/system/tftp.service
[root@srv-tftp-01 ~]# grep -- -s /etc/systemd/system/tftp.service 
ExecStart=/usr/sbin/in.tftpd -c -s /var/lib/tftpboot
[root@srv-tftp-01 ~]# systemctl daemon-reload
[root@srv-tftp-01 ~]# systemctl restart tftp

[root@srv-tftp-01 ~]# tftp localhost -c put ./date 
[root@srv-tftp-01 ~]# ll /var/lib/tftpboot/
total 0
-rw-rw-rw-. 1 nobody nobody 0 Oct 14 10:17 date