ubuntu中配置tftp服务

来源:互联网 发布:单片机读写u盘 编辑:程序博客网 时间:2024/04/29 16:39

1、安装

sudo apt-get install tftp

sudo apt-get install xinetd

 

2、创建共享目录

sudo mkdir /tftpboot

3、把共享目录修改为最大权限

sudo chmod 777 tftpboot

4、修改配置文件(/etc/inetd.conf)

1、我们看下我们默认的配置文件,配置文件如下

# /etc/inetd.conf:  see inetd(8) for further informations.

#

# Internet superserver configuration database

#

#

# Lines starting with "#:LABEL:" or "#<off>#" should not

# be changed unless you know what you are doing!

#

# If you want to disable an entry so it isn't touched during

# package updates just comment it out with a single '#' character.

#

# Packages should modify this file by using update-inetd(8)

#

# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>

#

#:INTERNAL: Internal services

#discard stream tcp nowait root internal

#discard dgram udp wait root internal

#daytime stream tcp nowait root internal

#time stream tcp nowait root internal

#:STANDARD: These are standard services.

#:BSD: Shell, login, exec and talk are BSD protocols.

#:MAIL: Mail, news and uucp services.

#:INFO: Info services

#: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

#:RPC: RPC based services

#:HAM-RADIO: amateur-radio services

#:OTHER: Other services

 

2、修改配置文件内容(添加我们刚才新建的共享工作文件夹)

把该行 tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp

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

5、启动tftp服务器

sudo /etc/init.d/xinetd restart

sudo in.tftpd -l /tftpboot

6、测试

1、在共享文件夹中新建一个文件

touch test.txt

2、启动tftp

tftp 192.168.0.148

说明,ip地址是自己的ip地址,查询方法,ifconfig

3、get test.txt

如果在当前文件夹看到test.txt则设置成功,否则重新检查配置

0 0