Thursday, May 16, 2013

How to enable native tftpd on Mac OS X Mountain Lion 10.8.2

I needed to tftp server to update IOS images for switches in my home lab. Mac OS X has its native tftp daemon and will do for the purpose.

To launch tftpd,
$ sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist
# Default tftp root directory, in which data files are stored, is /private/tftpboot/

To check tftp is up and running,
$ lsof -i:69

To stop tftpd
$ sudo launchctl unload /System/Library/LaunchDaemons/tftp.plist
or reboot the system.

Note:
1. tftpd will not start next time the system is booted. To make tftpd persistant, issue
$ sudo launchctl load -w /System/Library/LaunchDaemons/tftp.plist
1.1. -w option erases <key>Disabled</key> entry in tftp.plist and launch tftpd.
1.2. If you want to make tftpd persistant, think about security concerns since there is no authentication in tftp protocol. (i.e. at least adding -l option to tftpd.plist for logging, caring about permissions for files/directories.


To disable it,
$ sudo launchctl unload -w /System/Library/LaunchDaemons/tftp.plist

2. -F option is needed since /System/Library/LaunchDaemons/tftp.plist has <key>Disabled</key> entry.

3. The owner of /private/tftpboot/ is root and its permission is 755.

Reference:
man tftpd
man launchctl
man launchd.plist


No comments:

Post a Comment