Busybox
tftp - 錯誤程式碼 1:找不到文件
我需要正確的 tftp 語法來獲取和放置文件。我的最終目標是使用busybox tftp(這應該是第二個問題),但即使嘗試使用本地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 <ubuntu-devel-discuss@lists.ubuntu.com> 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
tftp 通常僅限於 /tftpboot 目錄,我不希望它能夠從使用者主目錄中獲取某些內容。
還要檢查文件權限。IIRC(已經有一段時間了),因為 tftp 是未經身份驗證的文件,因此需要全球可讀。