• Linux配置tftp服务器用于局域网文件传输


    1. 安装必备软件

    首先安装三个必备软件

    ~$ sudo apt-get install xinetd
    ~$ sudo apt-get install tftp
    ~$ sudo apt-get install tftp-server
    

    2. 修改配置文件

    修改 /etc/xinetd.d/tftp 文件,主要是设置TFTP服务器的根目录,开启必要的服务等。修改之后的文件如下

    service tftp
    {
           socket_type           =dgram
           protocol              =udp
           wait                  =yes
           user                  =root
           server                =/usr/sbin/in.tftpd
           server_args           =-s  /home/cv/tftpboot -c
           disable               =no
           per_source            =11
           cps                   =1002
           flags                 =IPv4
    }
    

    修改项 server_args= -s <path> -c 中的 path 改为你希望设置的 tftp-server 的根目录,参数-s指定chroot,-c表示可以在该路径下创建文件。

    3. 启动tftp服务器并关闭防火墙

    /etc/init.d/iptables stop        # 关闭防火墙
    sudo /sbin/service xinetd start
    或
    service xinetd restart
    /etc/init.d/xinetd start
    

    看到启动[OK]就可以了

    4. 查看tftp服务是否开启

    netstat -a | grep tftp
    

    显示结果为udp 0 0 *:tftp :表明服务已经开启,就表明tftp配置成功了。

    5. tftp命令的用法

    命令格式为:

    tftp [option]... host [port]
    

    如果要下载或上传文件的话是一定要用这些[option]的。

    -g 表示下载文件(get)
    -p 表示上传文件(put)
    -l 表示本地文件名(local file)
    -r 表示远程主机的文件名(remote file)

    例如,要从远程主机192.168.1.2上下载 test.txt,则应输入以下命令

    tftp -g -r test.txt 192.168.1.2
    

    将磁盘中的文件上传到远程主机的命令

    tftp -p -l file.txt 192.168.1.2
    

    转载自 tftp 在本机和tftp服务器之间使用TFTP协议传输文件

  • 相关阅读:
    LeetCode153.寻找旋转排序数组中的最小值
    LeetCode88.合并两个有序数组
    分析树
    LeetCode119.杨辉三角 II
    ssh传输文件
    ubuntu arm妙算加载cp210x驱动
    terminator终端工具
    ros使用rplidar hector_mapping建地图
    launch文件
    eclipse配置ros cakin编译环境
  • 原文地址:https://www.cnblogs.com/phillee/p/14888888.html
Copyright © 2020-2023  润新知