linux系统中安装TFTP服务简单文件传输协议

TFTP(Trivial File Transfer Protocol)

TFTP:  基于UDP协议,占用的端口号为69

TFTP:不需要客户端的权限认证(匿名用户模式??)

TFTP:传输琐碎文件(trivial)时,效率高

TFTP服务采用服务器端/客户端的方式,以下实验中PC1为服务器端,IP为192.168.10.10,PC2为客户端

1、在PC1服务器端安装TFTP的软件包

[root@PC1 ~]# yum install tftp-server.x86_64 tftp
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel7                                                    | 4.1 kB     00:00     
Resolving Dependencies
--> Running transaction check
---> Package tftp.x86_64 0:5.2-11.el7 will be installed
---> Package tftp-server.x86_64 0:5.2-11.el7 will be installed
--> Processing Dependency: xinetd for package: tftp-server-5.2-11.el7.x86_64
--> Running transaction check
---> Package xinetd.x86_64 2:2.3.15-12.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch           Version                 Repository     Size
================================================================================
Installing:
 tftp                x86_64         5.2-11.el7              rhel7          35 k
 tftp-server         x86_64         5.2-11.el7              rhel7          44 k
Installing for dependencies:
 xinetd              x86_64         2:2.3.15-12.el7         rhel7         128 k

Transaction Summary
================================================================================
Install  2 Packages (+1 Dependent package)

Total download size: 207 k
Installed size: 373 k
Is this ok [y/d/N]: y
Downloading packages:
--------------------------------------------------------------------------------
Total                                              560 kB/s | 207 kB  00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 2:xinetd-2.3.15-12.el7.x86_64                                1/3 
  Installing : tftp-server-5.2-11.el7.x86_64                                2/3 
  Installing : tftp-5.2-11.el7.x86_64                                       3/3 
rhel7/productid                                          | 1.6 kB     00:00     
  Verifying  : 2:xinetd-2.3.15-12.el7.x86_64                                1/3 
  Verifying  : tftp-5.2-11.el7.x86_64                                       2/3 
  Verifying  : tftp-server-5.2-11.el7.x86_64                                3/3 

Installed:
  tftp.x86_64 0:5.2-11.el7            tftp-server.x86_64 0:5.2-11.el7           

Dependency Installed:
  xinetd.x86_64 2:2.3.15-12.el7                                                 

Complete!

 

2、在PC1服务器端开启tftp服务(tftp服务是使用xinetd服务程序来管理的)

[root@PC1 ~]# vim /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /var/lib/tftpboot
        disable                 = no    ## 此处改为no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

 

3、在PC1服务器端重启xinetd服务

[root@PC1 ~]# systemctl restart xinetd.service 
[root@PC1 ~]# systemctl enable xinetd

 

4、在PC1服务器端将69端口加入防火墙允许策略中

[root@PC1 ~]# firewall-cmd --permanent --add-port=69/udp
success
[root@PC1 ~]# firewall-cmd --reload
success

 

5、PC2客户机中安装tftp

[root@PC2 test]# yum install tftp-server.x86_64 tftp
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package tftp.x86_64 0:5.2-11.el7 will be installed
---> Package tftp-server.x86_64 0:5.2-11.el7 will be installed
--> Processing Dependency: xinetd for package: tftp-server-5.2-11.el7.x86_64
--> Running transaction check
---> Package xinetd.x86_64 2:2.3.15-12.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch           Version                 Repository     Size
================================================================================
Installing:
 tftp                x86_64         5.2-11.el7              rhel7          35 k
 tftp-server         x86_64         5.2-11.el7              rhel7          44 k
Installing for dependencies:
 xinetd              x86_64         2:2.3.15-12.el7         rhel7         128 k

Transaction Summary
================================================================================
Install  2 Packages (+1 Dependent package)

Total download size: 207 k
Installed size: 373 k
Is this ok [y/d/N]: y
Downloading packages:
--------------------------------------------------------------------------------
Total                                              1.4 MB/s | 207 kB  00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 2:xinetd-2.3.15-12.el7.x86_64                                1/3 
  Installing : tftp-server-5.2-11.el7.x86_64                                2/3 
  Installing : tftp-5.2-11.el7.x86_64                                       3/3 
  Verifying  : 2:xinetd-2.3.15-12.el7.x86_64                                1/3 
  Verifying  : tftp-5.2-11.el7.x86_64                                       2/3 
  Verifying  : tftp-server-5.2-11.el7.x86_64                                3/3 

Installed:
  tftp.x86_64 0:5.2-11.el7            tftp-server.x86_64 0:5.2-11.el7           

Dependency Installed:
  xinetd.x86_64 2:2.3.15-12.el7                                                 

Complete!

 

 

6、 在PC2客户机中清空防火墙策略并保存

[root@PC2 test]# iptables -F
[root@PC2 test]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]

 

7、tftp服务远程登录的默认路径为/var/bin/tftpboot, 在PC1服务器端创建测试数据

[root@PC1 tftpboot]# pwd
/var/lib/tftpboot
[root@PC1 tftpboot]# ls
[root@PC1 tftpboot]# echo "i am pc1.file" > pc1.file
[root@PC1 tftpboot]# ls
pc1.file

 

8、在PC2服务端创建测试数据,并测试传输

[root@PC2 test]# pwd
/home/test
[root@PC2 test]# echo "i am pc2" > pc2.file
[root@PC2 test]# ls
pc2.file
[root@PC2 test]# pwd
/home/test
[root@PC2 test]# echo "i am pc2" > pc2.file
[root@PC2 test]# ls
pc2.file
[root@PC2 test]# tftp 192.168.10.10
tftp> get pc1.file  ## 测试传输至本地
tftp> quit
[root@PC2 test]# ls
pc1.file  pc2.file
[root@PC2 test]# cat pc1.file 
i am pc1.file
[root@PC2 test]# ls
pc1.file  pc2.file
[root@PC2 test]# tftp 192.168.10.10
tftp> put pc2.file
Error code 1: File not found    ## 上传报错 
tftp> 

 

9、在PC1服务器端修改配置文件

[root@PC1 tftpboot]# vim /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /var/lib/tftpboot -c
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

 

10、在PC1服务器端重启xinetd服务

[root@PC1 tftpboot]# systemctl restart xinetd.service 

 

11、 在PC2客户端继续测试上传

[root@PC2 test]# ls
pc1.file  pc2.file
[root@PC2 test]# pwd
/home/test
[root@PC2 test]# tftp 192.168.10.10
tftp> put pc2.file 
Error code 0: Permission denied   ## 上传继续报错,这次显示权限问题
tftp> 

 

12、在PC1服务器端修改路径权限

[root@PC1 lib]# ll -d /var/lib/tftpboot/
drwxr-xr-x. 2 root root 21 Dec 15 00:38 /var/lib/tftpboot/
[root@PC1 lib]# chmod -R 777 /var/lib/tftpboot/
[root@PC1 lib]# ll -d /var/lib/tftpboot/
drwxrwxrwx. 2 root root 21 Dec 15 00:38 /var/lib/tftpboot/

 

13、在PC2客户端继续测试上传

[root@PC2 test]# ls
pc1.file  pc2.file
[root@PC2 test]# tftp 192.168.10.10
tftp> put pc2.file 
tftp> 
[root@PC1 tftpboot]# ls
pc1.file  pc2.file
[root@PC1 tftpboot]# cat pc2.file 
i am pc2
[root@PC1 tftpboot]# pwd
/var/lib/tftpboot

终于实现上传。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


系ubuntu 下面打开终端输入:sudo apt-get install sendmail一般就安装完成噶啦跟住进入 /etc/mail/目录输入:m4 sendmail.mc > sendmail.cf意思系跟住.mc文件 生成 sendmial.cf文件输入呢个命令:ps aux | g
依家我有1个软件goagent目录(大家懂得) 放在/home/gateman/Programs/ 下 1. proxy.py 入面有1个 proxy.py 文件 放在/home/gateman/Programs/goagent/local/ 入面 2.breakwall.sh 我在 proxy.p
其实我想讲的是 cp -L关于-L参数的解释:-L, --dereference always follow symbolic links in SOURCE意思是如果复制目标是1个软链接,则复制链接的目标 不是链接本身做个例子: 例如 ~/tmp/fo1 入面有1个c.txt 文件 和 指向他的软
原地址:http://www.rjgc.net/control/content/content.php?nid=4418 1、将文件checkout到本地目录svn checkout path(path是服务器上的目录)例如:svn checkout svn://192.168.1.1/pro/do
chroot,即 change root directory (更改 root 目录)。在 linux 系统中,系统默认的目录结构都是以 `/`,即是以根 (root) 开始的。而在使用 chroot 之后,系统的目录结构将以指定的位置作为 `/` 位置。实例:用live CD ubuntu假设你的
简单解析下, stdin就是标准输入, stdout就是标准。举个例子, 在当前我要打包1个文件夹 /var/log/ 到当前目录下,并用zip压缩,那么我们可以分步执行#tar -cvf log.tar /var/log/#zip -r log.tar.zip log.tar#rm -rf log
转自:http://man.ddvip.com/linux/Mandrakelinuxref/process-priority.html系统中运行的每个进程都有一个优先级(亦称“nice 值”),其范围从 -20 (最高优先级)到 19 (最低优先级)。默认情况下,进程的优先级是 0 (“基本”调度
str="/home/gateman" if [ ${str:0:1} = "/" ]; then echo "yes'fi ${str:0:1} 中0表示从第几个字符开始,1表示截取多长
转自:http://kwokchivu.blog.51cto.com/1128937/694347 在RedHat系统下用usermod 命令可把某用户添加进多个附属组,默认情况下,一次性添加多个附属组可用以下方式来添加: usermod -G 附属组1,附属组2,...,附属组X 用户名 但在添加
有个文件 test.txt 内容如下:bash-3.00$ cat test.txt user user user_hiuser #注:呢行系空行T JGATEMANGATTTTTEMANGABBEMANAAABbash-3.00$下面介绍下常用的通配符 配合grep 命令:1. ".&q
linux系统为每1个文件都分配有i索引节点(inode),系统根据呢d节点从磁盘找出数据。 一般来讲,每1个文件名(包含全路径)实际上都链接住1个i索引节点。inode实际上系乜咧? 其实可以算系1个指向磁盘具体位置(柱面,扇区之类)的指针, 系统分析某个文件的inode,得出磁盘柱面,扇区等数据
grep 可以立即为筛选, 一般的用法系 grep + 要查询的字段 + 文件(或者内容 例如| 传递既内容)1.grep + 要查询的字段 + 文件gateman@GPC:~/shell/SQL_GSI$ grep OID a.sqlWHERE OID=@BuildNOWHERE OID INWH
原文转自:http://www.ibm.com/developerworks/cn/linux/l-cn-vimcolumn/index.html开始之前人类大脑对文字的处理是平面式的,所以我们浏览文章、查找资料或者重构代码,要么是横向读,要么是纵向读,要么使用搜索功能,将文字作为一个平面整体。而在
PS:偶很喜欢用scp这个命令来传输数据。scp命令跟cp命令类似,只不过cp命令是在同一台机器上用的,scp是在两台机器上复制传输数据的命令。scp实质相当于利用SSH协议来传输数据的cp命令。 用法举例: 1、复制远程服务器的文件到本地: scp -P888 root@120.18.50.33:
打开终端,进入/bin/ls 一下会见到 bash sh 呢两个文件。其实距地系两个唔同既shell 解析器。如果在脚本a.sh 开头写入#!/bin/sh那么执行./a.sh 时候 就相当于 sh a.sh同理 开头写入#!/bin/bash执行./a.sh 时候 就相当于 bash a.sh如果
find查找文件的时候排除某个或几个文件或目录转自:http://www.cnblogs.com/starspace/archive/2008/10/20/1315380.html比如要在/usr/sam目录下查找不在dir1子目录之内的所有文件find /usr/sam -path "/
假设有变量 var=http://www.google.com/test.htm一 # 号截取,删除左边字符,保留右边字符。echo ${var#*//}其中 var 是变量名,# 号是运算符,*// 表示从左边开始删除第一个 // 号及左边的所有字符即删除 http://结果是 :www.goog
转自: http://edyfox.codecarver.org/html/_vimrc_for_beginners.htmlVIM 中可供用户定制的选项非常非常多,作为初学者,我们没有必要了解这么多东西。下面,滇狐简单列出了一些最常用的配置项,大家可以根据自己的需要将这些内容添加到自己的 .vim
转自:http://www.einit.com/user1/11/archives/2006/3603.htmlUnix/Linux下一般想让某个程序在后台运行,很多都是使用 & 在程序结尾来让程序自动运行。比如我们要运行mysql在后台: /usr/local/mysql/bin/mysq
首先, mount是类unix系统, 挂载设备到1个文件夹的操作命令, 注意系设备阿正常来讲,mount 是不能挂在文件夹到文件夹的。例如, 在我的~/tmp/ 目录中有两个文件夹fo1 fo2其中fo1 中有3个文件a.txt b.txt c.txt fo2 有4个 e.txt d.txt e.t