Ubuntu 16.04中安装tftp

16.04中安装tftp
1. 安装
$ apt-get install tftp-hpa tftpd-hpa
 
2. 建立目录
$ mkdir /tftpboot # 这是建立tftp传输目录。
$ sudo chmod 0777 /tftpboot
$ sudo touch test.txt # test.txt文件最好输入内容以便区分
 
3. 配置
# vi /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot" # 这里是你的tftpd-hpa的服务目录,这个想建立在哪里都行
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -c -s" # 这里是选项,-c是可以上传文件的参数,-s是指定tftpd-hpa服务目录,上面已经指定
 
4. 重启服务
$ sudo service tftpd-hpa restart # 启动服务,这里要注意,采用的独立服务形式。
 
5. 测试
# cd /home
# tftp localhost  #localhost 表示本机
tftp>get test.txt  //test.txt 是之前在 /tftpboot 目录下新建的文件
tftp>put test1.txt //test1.txt 是在 /home 目录下新建的文件
tftp>q
退出后,在/home目录下会有一个test.txt文件,在/tftpboot 目录下有test1.txt,表示tftp服务器安装成功!

猜你喜欢

转载自www.linuxidc.com/Linux/2016-07/133255.htm