EDA365电子论坛网

标题: Ubuntu-10.10下tftp服务器搭建 [打印本页]

作者: uperrua    时间: 2020-6-23 15:35
标题: Ubuntu-10.10下tftp服务器搭建

1、安装相关软件包:Ubuntu tftp(服务端),tftp(客户端),xinetd

root@xf:/# apt-get install tftpd tftp xinetd

正在读取软件包列表... 完成

正在分析软件包的依赖关系树      

正在读取状态信息... 完成      

下列【新】软件包将被安装:

  tftp tftpd xinetd

升级了 0 个软件包,新安装了 3 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。

需要下载 185kB 的软件包。

解压缩后会消耗掉 578kB 的额外空间。

获取:1 http://mirrors.sohu.com/ubuntu/ karmic/universe tftp i386 0.17-17ubuntu1 [17.6kB]

获取:2 http://mirrors.sohu.com/ubuntu/ karmic/main xinetd i386 1:2.3.14-7ubuntu2 [151kB]

获取:3 http://mirrors.sohu.com/ubuntu/ karmic/universe tftpd i386 0.17-17ubuntu1 [16.5kB]

下载 185kB,耗时 2秒 (79.6kB/s)

选中了曾被取消选择的软件包 tftp。

(正在读取数据库 ... 系统当前共安装有 173693 个文件和目录。)

正在解压缩 tftp (从 .../tftp_0.17-17ubuntu1_i386.deb) ...

选中了曾被取消选择的软件包 xinetd。

正在解压缩 xinetd (从 .../xinetd_1%3a2.3.14-7ubuntu2_i386.deb) ...

选中了曾被取消选择的软件包 tftpd。

正在解压缩 tftpd (从 .../tftpd_0.17-17ubuntu1_i386.deb) ...

正在处理用于 man-db 的触发器...

正在处理用于 ureadahead 的触发器...

正在设置 tftp (0.17-17ubuntu1) ...

正在设置 xinetd (1:2.3.14-7ubuntu2) ...

* Stopping internet superserver xinetd                                                                              

[ OK ]

* Starting internet superserver xinetd                                                                              

[ OK ]

正在设置 tftpd (0.17-17ubuntu1) ...

Note: xinetd currently is not fully supported by update-inetd.

      Please consult /usr/share/doc/xinetd/README.Debian and itox(8).

2、建立配置文件: {% X" f0 N  j, ?  [$ T
在/etc/xinetd.d/下建立一个配置文件tftp# ~, r# g5 Q3 L( r3 M3 _9 ~$ b
sudo vim tftp2 N( n" ^2 [  i4 ^8 L% @1 y
在文件中输入以下内容:
# E) q$ v# l! ]service tftp. n3 w3 B$ F+ _; Q; ]) l
{

socket_type = dgram
; |( R* I) I$ E. f" Pprotocol = udp% }" L+ L$ `  H4 s
wait = yes2 ^7 e. x" e3 y, ~1 U1 d1 `& E- B. G
user = root
( S; K6 ?* g* dserver = /usr/sbin/in.tftpd. u1 N+ I; {5 N# A
server_args = -s /tftpboot
' j: X8 R3 l! O4 Idisable = no7 v8 f6 M( C& F, C! e6 ~
per_source = 111 E7 r, G7 d3 n
cps = 100 2) _; h7 F% I6 l/ ]
flags = IPv4

}

保存退出。

3、建立Ubuntu tftp服务文件目录(上传文件与下载文件的位置),并且更改其权限
% f# v, T5 J9 q/ X+ G( ~sudo mkdir /tftpboot) O& O, Z# n$ H6 X5 K, f$ n: ]
sudo chmod 777 /tftpboot -R

4、重新启动服务
: W' E" v. I$ l; V! q4 V% U6 O) usudo /etc/init.d/xinetd restart

至此Ubuntu tftp服务已经安装完成了,下面可以对其进行一下测试。(在当前目创建2.c,在tftpboot目录下创建1.c和2.c,且

tftpboot目录下2.c权限为777)

执行get命令时,保证tftpboot目录下的文件权限为777,

执行put命令时,必须先在tftpboot目录下新建一个和上传文件同名的文件且权限为777.

root@xf:/home# tftp 127.0.0.1

tftp> get 1.c

Received 7 bytes in 0.1 seconds

tftp> put 2.c

Sent 10 bytes in 0.0 seconds

tftp> quit

root@xf:/home# ls

1.c  2.c  ubuntu-10.10下编译环境的搭建.txt  xiaofeng

root@xf:/home# cd /tftpboot/

root@xf:/tftpboot# ls

1.c  2.c

1 s9 f7 v7 z# h% d" E

作者: regngfpcb    时间: 2020-6-23 16:58
Ubuntu-10.10下tftp服务器搭建




欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/) Powered by Discuz! X3.2