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

ubuntu 12.04 tftp的安装与设置

2013-05-30 20:10 337 查看


ubuntu 12.04 tftp的安装与设置

因为需要在u-boot下引导内核,所以在ubuntu下tftp服务器

为了方便配置,最好用root帐户

安装tftp-hpa   tftpd-hpa  xinetd

sudo apt-get install tftp-hpa tftpd-hpa xinetd

在根目录下创建文件夹/tftpboot/

修改目录权限chmod -R 777 /tftpboot/

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

#gedit /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

             per_source          = 11

             cps             = 100 2

             flags =IPv4

         }

修改inetd.conf文件

# gedit /etc/inetd.conf

 tftp  dgram    udp    wait    nobody    /usr/sbin/tcpd

 /usr/sbin/in.tftpd   /tftpboot/

其中/tftpboot/root为 tftp共享目录

修改tftpd-hpa文件

# vim /etc/default/tftpd-hpa 

#RUN_DAEMON="no"

#OPTIONS="-s /tftpboot/root -c -p -U tftpd"

TFTP_USERNAME="tftp"

TFTP_DIRECTORY="/tftpboot"

TFTP_ADDRESS="0.0.0.0:69"

TFTP_OPTIONS="-l -c -s"

从新启动服务
/etc/init.d/xinetd restart

 /etc/init.d/tftpd-hpa restart

在/tftpboot/root下创建测试文件xxx

#cd /tftpboot/

#touch xxx

#chmod 777 xxx

测试一下 tftp服务:

#cd /

#tftp 127.0.0.1

tftp>get xxx

tftp>q

#ls

查看当前目录,发现xxx文件已在当前目录

如果上述设置还不行的话,那么就要把selinux禁用掉:

#gedit /etc/selinux/config      //如果没有selinux/config这个文件,则创建。

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#       enforcing - SELinux security policy is enforced.

#       permissive - SELinux prints warnings instead of enforcing.

#       disabled - SELinux is fully disabled.

SELINUX=enforcing

# SELINUXTYPE= type of policy in use. Possible values are:

#       targeted - Only targeted network daemons are protected.

#       strict - Full SELinux protection.

SELINUXTYPE=targeted

把上面的SELINUX=enforcing 改为:SELINUX=disa
4000
ble  禁用SeLinux

然后reboot重启PC

重启后再进行tftp测试。

转载自http://hi.baidu.com/prcyangli/item/b0693dd8d239a59d270ae7da

感谢原作者
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Ubuntu tftp