tftp-hpa客戶端使用說明


1、板子 sudo apt-get install tftp-hpa
2、主機chmod 777 tftp—dir
3、tftp -4 192.168.1.122 -c put lib2.tar.gz lib2.tar.gz
參考
1、http://blog.csdn.net/tchonggang77/article/details/7478371
2、http://www.tutorialspoint.com/unix_commands/tftp.htm
 
tftp [-i] [Host]              //全:tftp [-v][-m mode] [host [port]] [-c command]
{get | put} [Source] [Destination]

參數
-i

指 定二進制圖像傳送模式(也稱為八進制模式)。在二進制圖像模式下,文件以一個字節為單位進行傳輸。在傳送二進制文件時使用該模式。如果省略了 -i,文件將以 ASCII 模式傳送。這是默認的傳送模式。該模式將行尾 (EOL) 字符轉換為指定計算機的適當格式。傳送文本文件時使用該模式。如果文件傳送成功,將顯示數據傳輸率。

Host

指定本地或遠程計算機。

put

將本地計算機上的  Destination文件 傳送到遠程計算機上的  Source文件中。因為TFTP不支持用戶身份驗證,所以用戶必須登錄到遠程計算機,同時文件在遠程計算機上必須可寫。

get

將遠程計算機上的  Destination 文件傳送到本地計算機上的  Source 文件中。

Source

指定要傳送的文件。

Destination

指定將文件送達的 目標文件。如果省略了 Destination,將假定它與 Source 具有相同名稱。





#################################

shancy@Computer:~$ tftp 192.168.1.103
tftp> put /home/shancy/111.txt /tftpboot/test
Error code 0: Permission denied
tftp> 
 
 

NAME

tftp - Trivial File Transfer Protocol client

SYNOPSIS

tftp [  options... ] [ host [ port]] [ -c  command]

DESCRIPTION

tftp is a client for the Trivial file Transfer Protocol, which can be used to transfer files to and from remote machines, including some very minimalistic, usually embedded, systems. The remote  host may be specified on the command line, in which case  tftp uses  host as the default host for future transfers (see the  connect command below.)

OPTIONS

Tag Description
-4 Connect with IPv4 only, even if IPv6 support was compiled in.
-6 Connect with IPv6 only, if compiled in.
-c command
  Execute command as if it had been entered on the tftp prompt. Must be specified last on the command line.
-l Default to literal mode. Used to avoid special processing of ’:’ in a file name.
-m mode Set the default transfer mode to mode. This is usually used with -c.
-R port:port
  Force the originating port number to be in the specified range of port numbers.
-v Default to verbose mode.
-V Print the version number and configuration to standard output, then exit gracefully.

COMMANDS

Once  tftp is running, it issues the prompt  tftp> and recognizes the following commands:
Tag Description
? command-name... 
help command-name...
  Print help information
ascii Shorthand for mode ascii.
binary Shorthand for mode binary.
connect host [port]
  Set the host (and optionally port) for transfers. Note that the TFTP protocol, unlike the FTP protocol, does not maintain connections between transfers; thus, the connectcommand does not actually create a connection, but merely remembers what host is to be used for transfers. You do not have to use the connect command; the remote host can be specified as part of the get or put commands.
get file
   
get remotefile localfile
   
get file1 file2 file3...
  Get a file or set of files from the specified sources. A remote filename can be in one of two forms: a plain filename on the remote host, if the host has already been specified, or a string of the form host:filename to specify both a host and filename at the same time. If the latter form is used, the last hostname specified becomes the default for future transfers. Enable literal mode to prevent special treatment of the ’:’ character (e.g. C:\dir\file).
literal
  Toggle literal mode. When set, this mode prevents special treatment of ’:’ in filenames.
mode transfer-mode
  Specify the mode for transfers; transfer-mode may be one of ascii (or netascii) orbinary (or octet.) The default is ascii.
put file
   
put localfile remotefile
   
put file1 file2 file3... remote-directory
  Put a file or set of files to the specified remote file or directory. The destination can be in one of two forms: a filename on the remote host, if the host has already been specified, or a string of the form host:filename to specify both a host and filename at the same time. If the latter form is used, the hostname specified becomes the default for future transfers. If the remote-directory form is used, the remote host is assumed to be a UNIX system or another system using / as directory separator. Enable literal mode to prevent special treatment of the ’:’ character (e.g. C:\dir\file).
quit Exit tftp. End-of-file will also exit.
rexmt retransmission-timeout
  Set the per-packet retransmission timeout, in seconds.
status Show current status.
timeout total-transmission-timeout
  Set the total transmission timeout, in seconds.
trace Toggle packet tracing (a debugging feature.)
verbose
  Toggle verbose mode.

NOTES

The TFTP protocol provides no provisions for authentication or security. Therefore, the remote server will probably implement some kinds of access restriction or firewalling. These access restrictions are likely to be site- and server-specific.

AUTHOR

This version of  tftp is maintained by H. Peter Anvin < hpa@zytor.com>. It was derived from, but has substantially diverged from, an OpenBSD source base, with added patches by Markus Gutschke and Gero Kulhman.

SEE ALSO

  • tftpd (8)

    • 1.  Error code 0: Permission denied

      主目錄沒有寫權限, 可以 chmod  0777  /var/lib/tftpboot

      2.Error code 1: File not found

      在/etc/xinetd.d/tftp配置文件中,server_args后加上 -c 選項,方可上傳

      [plain] view plain  copy
      1. service tftp  
      2. {  
      3.     socket_type     = dgram  
      4.     protocol        = udp  
      5.     wait            = yes     
      6.     user            = root    
      7.     server          = /usr/sbin/in.tftpd  
      8.     server_args     = -s /var/lib/tftpboot -c  
      9.     disable         = no      
      10.     per_source      = 11      
      11.     cps             = 100 2   
      12.     flags           = IPv4    
      13. }  

      3. Transfer timed out.

      如果第1,2條都沒有問題,第3條可能是IPv6的原因,例如 在命令行下輸入

      # tftp localhost 

      系統可能使用的是IPv6的 ::1 地址,如下WireShark截圖:

      如果使用 # tftp 127.0.0.1  IPv4環回地址應該是沒有問題的。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM