ubuntu 12.04 安裝 tftp

來源:互聯網
上載者:User

安裝tftp-hpa   tftpd-hpa  xinetd

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

在根目錄下建立檔案夾/tftpboot/root

修改目錄許可權chmod -R 777 /tftpboot/root

 修改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/root
             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/root

其中/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/root"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -c -s"

從新啟動服務
/etc/init.d/xinetd restart

service tftp-hpa restart

 /etc/init.d/tftpd-hpa restart

在/tftpboot/root下建立測試檔案xxx

#cd /tftpboot/root

#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=disable  禁用SeLinux
然後reboot重啟PC

重啟後再進行tftp測試。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.