Skip to content

Commit

Permalink
Update linuxtool.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Ewenwan authored Apr 20, 2018
1 parent 1742a8e commit 9ca0269
Showing 1 changed file with 32 additions and 15 deletions.
47 changes: 32 additions & 15 deletions linuxtool.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,44 @@
   多台电脑之间创建共享文件夹
## nfs服务器端配置
### 1、安装nfs服务
sudo apt install nfs-common
   1.1-安装Ubuntu nfs服务器端:
sudo apt-get install nfs-kernel-server
       (在安装nsf-kernel-server的时候,也会安装nfs-commom。如果没有安装这个软件包,则要执行1.2中的命令了)
   1.2-安装nfs的客户端:
sudo apt-get install nfs-common


### 2、修改配置文件
sudo vim /etc/exports

修改内容如下:
/home *(rw,sync,no_root_squash)

/home :共享的目录
* :指定哪些用户可以访问
           * 所有可以ping通该主机的用户
192.168.1.* 指定网段,在该网段中的用户可以挂载
192.168.1.12 只有该用户能挂载
(ro,sync,no_root_squash): 权限
ro : 只读
rw : 读写
sync : 同步
no_root_squash: 不降低root用户的权限
其他选项man 5 exports 查看
/home :共享的目录
* :指定哪些用户可以访问
* 所有可以ping通该主机的用户
192.168.1.* 指定网段,在该网段中的用户可以挂载
192.168.1.12 只有该用户能挂载
(ro,sync,no_root_squash): 权限
ro : 只读
rw : 读写
sync : 同步
no_root_squash: 不降低root用户的权限
       其他选项man 5 exports 查看
前面那个目录是与nfs服务客户端共享的目录,
*代表允许所有的网段访问(也可以使用具体的IP)
rw:挂接此目录的客户端对该共享目录具有读写权限
sync:资料同步写入内存和硬盘
no_root_squash:客户机用root访问该共享文件夹时,不映射root用户。
root_squash:客户机用root用户访问该共享文件夹时,将root用户映射成匿名用户
   no_subtree_check:不检查父目录的权限。

2.2-nfs是一个RPC程序,使用它前,需要映射好端口,通过rpcbind 设定:
sudo service rpcbind restart restart
2.3-重启nfs服务:
sudo service restartnfs-kernel-server restart
2.4-测试运行以下命令来显示一下共享出来的目录:
showmount -e

### 4、重启nfs服务
sudo /etc/init.d/nfs-kernel-server restart  
到此,nfs的服务就搭建好了。 

## 客户端访问配置

0 comments on commit 9ca0269

Please sign in to comment.