Chinaunix首页 | 论坛 | 博客
  • 博客访问: 38638
  • 博文数量: 25
  • 博客积分: 605
  • 博客等级: 中士
  • 技术积分: 255
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-03 21:57
文章分类

全部博文(25)

文章存档

2012年(22)

2011年(3)

我的朋友

分类: LINUX

2012-05-01 11:14:57

%E8%88%87_xinetd_%E7%9A%84%E5%AE%89%E8%A3%9D:_Debian/Ubuntu
套件資訊
[]

安裝 tftpd-hpa 與 xinetd

在Ubuntu下,tftp是不能單獨運作的,需要xinetd這個網路管理的背景程式之支援。於是我們同時安裝這兩個套件。

$ sudo apt-get install tftpd-hpa xinetd tftp-hpa
[]

xinetd.conf 設定

安裝完tftp與xinetd後,需要在xinetd的設定檔/etc/xinetd.conf中寫入相關設定。

$cat /etc/xinetd.conf # Simple configuration file for xinetd # Some defaults, and include /etc/xinetd.d/ defaults { # Please note that you need a log_type line to be able to use log_on_success # and log_on_failure. The default is the following : # log_type = SYSLOG daemon info } includedir /etc/xinetd.d

雖然我們可以將設定內容寫入此處,但還有更好的設定檔設定方法。xinetd.conf引入專門存放設定檔的資料夾includedir /etc/xinetd.d。因此更結構化的設定檔配置就是自己建立一個tftp設定檔於此資料夾內。

$sudo vim /etc/xinetd.d/tftp

存入

service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /home/hnmsky/netshare disable = no per_source = 11 cps = 100 2 flags = IPv4 }

由於背景網路程式已經由inetd更換成xinetd,可將/etc/inetd.conf中關於tftp的部份註解以避免混淆。

#:BOOT: TFTP service is provided primarily for booting. Most sites # run this only on machines acting as "boot servers." #tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp .配置TFTP服务器

sudo gedit /etc/default/tftpd-hpa

将原来的内容改为:

# /etc/default/tftpd-hpa

 


TFTP_USERNAME="tftp"
#TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
#TFTP_OPTIONS="--secure"

#服务器目录,需要设置权限为777,chomd 777

#这个目录要改为你自己的TFTP根目录~~~

TFTP_DIRECTORY="/home/stone/tmp"

TFTP_OPTIONS="-l -c -s"


RUN_DAEMON="yes" #不确定

3.重新启动TFTP服务

sudo service tftpd-hpa restart

 

完成以上設定後,還需要讓xinetd讀入新參數並重新啟動。

sudo /etc/init.d/xinetd reload sudo /etc/init.d/xinetd restart

檢查一下tftp是否真的在運作

$ sudo netstat -anp | grep tftp udp 0 0 0.0.0.0:69 0.0.0.0:* 5249/in.tftpd unix 2 [ ] DGRAM 17654 5249/in.tftpd
阅读(571) | 评论(0) | 转发(1) |
0

上一篇:一个oops问题的调试

下一篇:ubifs 调试

给主人留下些什么吧!~~