您的位置:首页 > 编程语言 > PHP开发

Ubuntu 下配置 tftp 服务器

2013-11-28 15:32 399 查看
以下操作默认都是在 root 账户下进行的。

1. 安装服务
  安装tftp-hpa tftpd-hpa xinetd

apt-get install tftp-hpa tftpd-hpa xinetd


2. 在创建文件夹/tftpboot,修改权限为777

mkdir /tftpboot
chmod -R 777 /tftpboot


3. 修改tftp配置文件,如果没有就创建

vim  /etc/xinetd.d/tftp


文件内容为:

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


4. 修改inetd.conf文件

vim /etc/inetd.conf


一般这个文件在打开的时候里面是有内容的,只要在最后添加下面内容即可:

tftp  dgram    udp    wait    nobody    /usr/sbin/tcpd
/usr/sbin/in.tftpd   /tftpboot


5. 修改tftpd-hpa文件

vim /etc/default/tftpd-hpa


内容为:

#RUN_DAEMON="no"
#OPTIONS="-s /home/zyp/tftpboot -c -p -U tftpd"
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"       // 此处文件目录就是上面说道的服务器文件交换目录
TFTP_ADDRESS="0.0.0.0:69"       // tftp服务的默认端口号为69
TFTP_OPTIONS="-l -c -s"


6. 重启服务

service tftpd-hpa restart
/etc/init.d/xinetd reload
/etc/init.d/xinetd restart


7. 本地测试
(1)在/tftpboot 下创建测试文件test,并修改test的文件权限

cd /tftpboot
touch test
chmod 777 test


(2)测试 tftp 服务:

//以根目录为例,将/tftpboot/test文件下载到根目录下

cd /
tftp 127.0.0.1
tftp>get test
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: