Ubuntu 16.04 SSH TFTP NFS服务安装

SSH服务安装

  1. 安装
    sudo apt-get install openssh-server
  2. 启动
    sudo service ssh start
  3. 查询服务启动状态:
    sudo ps -e | grep ssh

TFTP服务安装

  1. 安装
    apt-get install tftp-hpa tftpd-hpa

  2. 建立目录
    mkdir /tftpboot # 这是建立tftp传输目录
    sudo chmod 777 /tftpboot
    sudo touch test.txt # test.txt文件最好输入内容以便区分

  3. 配置
    sudo 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服务器安装成功!

NFS服务安装

1、安装nfs服务
sudo apt install nfs-kernel-server

2、修改配置文件
sudo vim /etc/exports
修改内容如下:

/home *(rw,sync,no_root_squash)

各段表达的意思如下,根据实际进行修改
/home :共享的目录*
*:指定哪些用户可以访问
(ro,sync,no_root_squash): 权限
ro : 只读
rw : 读写
sync : 同步
no_root_squash: 不降低root用户的权限
其他选项man 5 exports 查看

3、重启nfs服务
sudo /etc/init.d/nfs-kernel-server restart

猜你喜欢

转载自blog.csdn.net/Run_Feng/article/details/108403624
今日推荐