tftp - エラーコード1:ファイルが見つかりません

tftp - エラーコード1:ファイルが見つかりません

ファイルをインポートして挿入するには、正しいtftp構文が必要です。私の究極の目標はbusybox tftpを使用することです(2番目の質問でなければなりません)。しかし、ローカルのUbuntu tftpクライアントでテストしようとすると失敗します。

以下に示すようにftp問題はありませんtftp。問題があるだけです。これはループバックIPなので、iptablesには関連してはいけません(もう一度言ってもftp問題ありません)。潜在的な長いパスの問題を防ぐために、テストにはホームディレクトリのみを使用しました。

xb@dnxb:/tmp$ grep anon_root /etc/vsftpd.conf
anon_root=/home/xiaobai/
xb@dnxb:/tmp$ cat /home/xiaobai/haha
7
xb@dnxb:/tmp$ ftp 127.0.0.1
Connected to 127.0.0.1.
220 (vsFTPd 3.0.3)
Name (127.0.0.1:xiaobai): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> get haha
local: haha remote: haha
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for haha (2 bytes).
226 Transfer complete.
2 bytes received in 0.00 secs (6.5541 kB/s)
ftp> 221 Goodbye.
xb@dnxb:/tmp$ tftp 127.0.0.1
tftp> get haha
Error code 1: File not found
tftp> get /home/xiaobai/haha
Error code 1: File not found
tftp> get /home/xiaobai/haha output
Error code 1: File not found
tftp> put /home/xiaobai/haha        
Error code 1: File not found
tftp> put haha
Error code 1: File not found
tftp> xb@dnxb:/tmp$ dpkg-query -W -f='${Description}\n\n${Homepage}\nMaintainer: ${Maintainer}\n\n' tftp
Trivial file transfer protocol client
 Tftp is the user interface to the Internet TFTP (Trivial File Transfer
 Protocol), which allows users to transfer files to and from a remote machine.
 The remote host may be specified on the command line, in which case tftp uses
 host as the default host for future transfers.

http://www.hcs.harvard.edu/~dholland/computers/netkit.html
Maintainer: Ubuntu Developers <[email protected]>

xb@dnxb:/tmp$

だから私は従うこの回答:

xb@dnxb:/tmp$ tftp -v 127.0.0.1 -c get haha
usage: tftp host-name [port]
tftp> xb@dnxb:/tmp$ 
xb@dnxb:/tmp$ tftp -v 127.0.0.1 -c get /home/xiaobai/haha
usage: tftp host-name [port]
tftp> xb@dnxb:/tmp$ 
xb@dnxb:/tmp$ tftp -v 127.0.0.1 -c put haha
usage: tftp host-name [port]
tftp> xb@dnxb:/tmp$ tftp -v 127.0.0.1 -c put /home/xiaobai/haha
usage: tftp host-name [port]
tftp> ^F
?Invalid command
tftp> xb@dnxb:/tmp$ 
xb@dnxb:/tmp$ 

そしてこの回答(コメントしたりコメントしたりしなくても効果がないようで、service vsftpd restart編集後にこれをしました):

xb@dnxb:/tmp$ grep server_args /etc/xinetd.conf 
# server_args = -c -s /tftpboot
xb@dnxb:/tmp$ 

誰かが他のオプションを持っているbusybox tftpに答えることができれば、より良いでしょう。

# busybox tftp                                    
BusyBox v1.22.1 bionic (2017-11-04 12:54 +0800) multi-call binary.

Usage: tftp [OPTIONS] HOST [PORT]

Transfer a file from/to tftp server

        -l FILE Local FILE
        -r FILE Remote FILE
        -g      Get file
        -p      Put file

ベストアンサー1

tftpは通常/ tftpbootディレクトリに制限されており、ユーザーのホームディレクトリから何かをインポートできるようにしたくありません。

また、ファイル権限を確認してください。 IIRC(久しぶりです)。 tftpは認証されていないファイルなので、世界中で読むことができるはずです。

おすすめ記事