LoginSignup
2
2

More than 1 year has passed since last update.

ubuntsでTFTPサーバをたてる

Posted at

概要

仕事でTFTPサーバを使うことになったので調べてみた。
TFTPサーバとはUDPを使ったFTPのようなものらしい。(概要を斜め読みしただけ)
環境はUbuntu 18.04.6 LTS
TFTPサーバをたててputとgetをしてみる。

TFTPサーバのたてかた

まずはインストール

$ sudo apt-get install tftpd-hpa

環境ファイルの編集
tftpd-hpaはsudoしないと編集できない
TFTP_OPTIONSを編集する。

$ sudo vi /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS=":69"
#TFTP_OPTIONS="--secure"
TFTP_OPTIONS="-c -v -s"

ディレクトリの権限の変更
/var/lib/tftpbootの所有者をtftpに変更しないと、この後のputがうまく動かなかった
tftpユーザとは・・・?私にはわかりませんでした

$ sudo chown tftp /var/lib/tftpboot
$ ls -l
drwxr-xr-x  2 tftp      nogroup   4096 Apr  3 00:19 tftpboot

サーバ再起動

$ sudo service tftpd-hpa restart

これで準備完了

TFTPクライアントからget/putしてみる

まずはクライアントをインストールする

$ sudo apt install tftp

次にput/getしてみる

$ tftp
tftp> connect localhost
tftp> put text.txt
Sent 116 bytes in 0.0 seconds
tftp> get text.txt
Received 116 bytes in 0.0 seconds

「Error code 0: Permission denied」がでる場合は「ディレクトリの権限の変更」を参照

以上

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2