无忧自助建站,网站后台模板免费下载,自己做网站需要什么技能,定制vx怎么弄架设一台NFS服务器#xff0c;并按照以下要求配置#xff1a;
1、开放/nfs/shared目录#xff0c;供所有用户查询资料#xff1a;
2、开放/nfs/upload目录#xff0c;为192.168.xxx.0/24网段主机可以上传目录#xff0c;并将所有用户及所属的组映射为nfs-upload,其UID和…架设一台NFS服务器并按照以下要求配置
1、开放/nfs/shared目录供所有用户查询资料
2、开放/nfs/upload目录为192.168.xxx.0/24网段主机可以上传目录并将所有用户及所属的组映射为nfs-upload,其UID和GID均为2103
3将/home/tom目录仅共享给192.168.xxx.xxx这台主机并只有用户tom对该目录有读写权限 一开放 /nfs/shared目录
服务端
创建该目录 [rootlocalhost ~]# mkdir /nfs/shared/ -p 在 /etc/exports下编辑开放的目录 [rootlocalhost shared]# vim /etc/exports 重启nfs服务 [rootlocalhost shared]# systemctl stop firewalld---关闭防火墙 [rootlocalhost shared]# setenforce 0 ---关闭selinux [rootlocalhost shared]# exportfs -ra 客户端
首先查看共享的目录信息 [rootlocalhost ~]# showmount -e 192.168.79.129 Export list for 192.168.79.129: /nfs/shared * 挂载 [rootlocalhost ~]# mount 192.168.79.129:/nfs/shared /test [rootlocalhost ~]# ll /test total 0 -rw-r--r--. 1 root root 0 Oct 28 22:01 1 -rw-r--r--. 1 root root 0 Oct 28 22:01 2 -rw-r--r--. 1 root root 0 Oct 28 22:01 3 二开放/nfs/upload目录
服务端 更改配置文件 [rootlocalhost ~]# cat /etc/exports /nfs/shared/ *() /nfs/upload/ 192.168.79.0/24(rw,all_squash,anonuid2103,anongid2103) 重启服务 [rootlocalhost ~]# exportfs -ra 创建用户 [rootlocalhost ~]# useradd -u 2103 nfs 赋予权限 [rootlocalhost ~]# chmod ow /nfs/upload 客户端 查看共享目录文件 [rootlocalhost ~]# showmount -e 192.168.79.129 Export list for 192.168.79.129: /nfs/shared * /nfs/upload 192.168.79.0/24 挂载 [rootlocalhost ~]# mount 192.168.79.129:/nfs/upload /nfs-upload 创建用户 [rootlocalhost ~]# useradd -u 2103 nfs-upload 创建文件 [rootlocalhost ~]# touch /nfs-upload/a [rootlocalhost ~]# ll /nfs-upload total 0 -rw-r--r--. 1 up-load up-load 0 Oct 29 18:31 a -rw-r--r--. 1 root root 0 Oct 29 17:39 {a...c} 基于id操作
三/home/tom目录
服务端 [rootlocalhost ~]# cat /etc/exports /nfs/shared/ *() /nfs/upload/ 192.168.79.0/24(rw,all_squash,anonuid2103,anongid2103) /home/tom 192.168.79.133(rw) 创建用户 [rootlocalhost ~]# useradd -u 111 tom 重启服务 [rootlocalhost ~]# exportfs -ra 客户端
挂载 [rootlocalhost ~]# mount 192.168.79.129:/home/tom /tom 创建用户 [rootlocalhost ~]# useradd -u 111 tom 测试
首先用root访问 [rootlocalhost ~]# cat /tom cat: /tom: Permission denied --------权限拒绝 使用tom用户访问 [rootlocalhost ~]# su - tom [tomlocalhost ~]$ cat /hom/tom cat: /hom/tom: No such file or directory -----访问成功