ubuntu下tftp安装和配置
来源:互联网 发布:电子发票软件下载 编辑:程序博客网 时间:2024/05/16 01:52
安装 上传 和 下载 ,可以在 软件中心 安装。
搜索tftp-hpa tftpd-hpa
安装 openbsd
sudo apt-get install tftp-hpa
sudo apt-get install tftpd-hpa
sudo apt-get install openbsd-inetd
sudo apt-get install xinetd
去建立一个根目录,然后设置对应的访问属性:
1. mkdir /tftpboot
2. cd /
3. chmod 777 tftpboot/
(a) 在 根目录 下 建立 tftpboot 这个文件夹存放 可以通过ftp协议 传输的文件。注意 该文件夹 及 文件的权限。
(b) chmod 777 就是更改该目录权限
更改配置文件/etc/default/tftpd-hpa
sudo vim /etc/default/tftpd-hpa
去修改配置文件,修改好后,内容如下:
1. # /etc/default/tftpd-hpa
2. RUN_DAEMON="yes"
3. OPTIONS="-l -s -c /tftpboot"
如果是10.04之前的版本 把下面四行注释掉,如果是 10.04以后的含10.04 把上面两行注释掉
4. TFTP_USERNAME="用户名"
5. TFTP_DIRECTORY="/tftpboot"
6. TFTP_ADDRESS="0.0.0.0:69"
7. TFTP_OPTIONS="-l -s -c"
绿色部分是要修改的, OPTIONS="-l -s -c /tftpboot" 绿色部分是 tftpboot 路径,TFTP_USERNAME="用户名" 绿色部分是用户名
TFTP_DIRECTORY="/tftpboot"绿色部分是 路径
OPTIONS="-l -s -c
中的参数含义为:
-l Run the server in standalone (listen) mode, rather than run from inetd. Inlisten mode, the -t option is ignored, and the -a option can be usedto specify a specific local address or port to listen to.
-a [address][:port]
Specify a specific address and port to listen to when called with the -loption. The default is to listen to the tftp port specified in /etc/services onall local addresses.
-c Allow new files to be created. By default, tftpd will only allow upload offiles that already exist. Files are created with default permissions allowinganyone to read or write them, unless the -p or -U options are specified.
-s (决定tftp根目录)Change rootdirectory on startup. This means the remote host does not need to pass alongthe directory as part of the trans-fer, and may add security. When -s isspecified, exactly one directory should be specified on the command line. Theuse of this option is recommended for security as well as compatibility withsome boot ROMs which cannot be easily made to include a directory name in itsrequest.
启动tftp 服务
sudo service tftpd-hpa restart
摘抄博友:
(1)关于重启 某个服务,之前的Linux(Ubuntu是10.10之前)都是这样操作的:
sudo /etc/init.d/XXX reload
对于inetd来说,就是:
sudo /etc/init.d/inetd reload
现在新的Ubuntu 10.10以后,是统一成调用service来操作了:
sudo service XXX restart
其中,启动和停止对应的是start和stop。
(2)记得不要少了sudo,否则“stop: Rejected send message”的错误。
(3)【确认tftp服务是否已经开启】
查看tftp相关进程:
输入 $ psaux |grep tftp
出现 root 3826 0.0 0.0 2352 120 ? Ss 14:270:00 /usr/sbin/in.tftpd --listen --user --address 0.0.0.0:69 --secure/home/crifan/develop/tftpboot usr 3828 0.0 0.0 5628 768 pts/0 S+14:27 0:00 grep --color=auto tftp
如果没有上面提示
{sudo/etc/init.d/xinetd restart
sudo/etc/init.d/tftpd-hpa restart}
验证tftp是否生效
tftp192.168.1.11 或者 127.0.0.1
tftp>get abc
tftp>quit
192.168.1.11通过 ifconfig 得出本机地址,127.0.0.1永远是本机地址
get命令 是 从 tftpboot里面 下载 文件
put 上传
你可以 建立在 home 目录下 建立一个 get文件夹,cd get
然后 tftp 127.0.0.1
>get abc(abc是tftpboot 里面已经存在的文件),
然后
>q
退出
ls
看到 get文件夹下面是不是已经有了 abc文件。注意把get文件夹 的权限设置 为 可写 可执行。chmod 777 get
附:不成功现象及解决。
现象一:
tftp>get file
Transfertimed out.
原因:
tftpd服务没有启动
解决方法:启动服务
sudo/etc/init.d/xinetd restart
sudo/etc/init.d/tftpd-hpa restart
现象二:
tftp>get file
Errorcode 2: Only absolute filenames allowed
原因:
在/etc/xinetd.d/tftpd中设置的server_args为/etc/default/tftpd-hpa
下面是我的机器上/etc/default/tftpd-hpa配置
#/etc/default/tftpd-hpa
RUN_DAEMON="yes"
TFTP_ADDRESS="0.0.0.0:69"
OPTIONS="-s /home/tftpd -c -p -U 077 -u tftpd"
现象三:
tftp>put file
Errorcode 1: File not found
原因:
指定的文件不存在;或tftpd启动参数中没有指定-c选项,允许上传文件~上传的时候一定要确保文件先存在于上传目录下。
现象四:
tftp>get file
tftp: : Permission denied
原因:权限不足
请查看chmod 是不是配置好
- ubuntu下tftp安装和配置
- Ubuntu下安装配置tftp
- ubuntu下tftp安装、配置、
- ubuntu下安装配置tftp
- Ubuntu下tftp和nfs的安装和配置
- Ubuntu下安装tftp服务器配置
- Ubuntu下安装配置tftp服务
- Ubuntu-14.04下安装、配置tftp服务器
- Ubuntu下安装配置tftp服务器
- ubuntu下tftp的安装、配置、使用
- ubuntu下tftp的安装、配置、使用
- ubuntu下tftp的安装、配置、使用
- Ubuntu 12.04下tftp安装配置
- ubuntu tftp服务安装和配置
- ubuntu 12.04安装、配置和使用tftp
- Ubuntu下配置tftp
- ubuntu 下 配置 tftp
- ubuntu下tftp安装和使用
- Linux 中断
- 如何使用SecureCRT连接ubuntu
- Ubuntu下ns2.35的安装设置
- linux的NFS详细配置方法
- 2015数学考取高分的五大关键点
- ubuntu下tftp安装和配置
- javascript中call与replace方法!
- 2009Round1C C
- 关于LINUX下添加IP后重启网络服务后IP添加失效解决方案
- C语言中的32个关键字及其意思
- GSM PDU 7bit短信编码与解码
- hdu 3405 World Islands
- Node.js模块定义
- 64位系统下注册32位dll文件