为了证明是 Allentunsgroup 组起的作用而非用户

[root@NFS_Client ~]# useradd scott1

[root@NFS_Client ~]# passwd scott1

Changing password for user scott1.

New password:

BAD PASSWORD: it is based on a dictionary word

Retype new password:

Sorry, passwords do not match.

New password:

BAD PASSWORD: it is based on a dictionary word

BAD PASSWORD: is too simple

Retype new password:

passwd: all authentication tokens updated successfully.

[root@allentuns onair]# su scott1

[scott1@NFS_Client ~]$ id

uid=501(scott1) gid=501(scott1) groups=501(scott1) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 [scott1@NFS_Client ~]$ touch d.sh

touch: cannot touch `d.sh': Permission denied

[scott1@NFS_Client ~]$ id

uid=501(scott1) gid=501(scott1) groups=501(scott1)

context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

[scott1@allentuns onair]$ exit

exit

[root@allentuns ~]# su scott1 [scott1@allentuns ~]$ touch d.sh [scott1@allentuns ~]$ ll

total 0

-rw-r--r--. 1 root    root            0
May  4 01:45 a.sh

-rw-r--r--. 1 nobody Allentunsgroup 0 May
 4 02:11 b.sh

-rw-r--r--. 1 nobody Allentunsgroup 0 May
 4 04:37 c.sh

-rw-r--r--. 1 nobody Allentunsgroup 0 May
 4 04:41 d.sh

---End2---

实验二 主要是 setfacl 的用法

实例三

仅给某个单一主机使用的目录设定

我要将一个私人的目录/homt/test 开放给 192.168.1.5 这个客户端,只有 apache 用户对此目录才

具有完整的权限

[ON Server]

[root@NFS_Server ~]# mkdir /home/test

[root@NFS_Server ~]# touch /home/test/ab.sh

[root@NFS_Server ~]# useradd apache
[root@NFS_Server ~]# passwd apache
Changing password for user apache.
New password:

BAD PASSWORD: it is
based on a dictionary word

BAD PASSWORD: is too simple

Retype new password:

[root@NFS_Server ~]# id apache

uid=502(apache) gid=502(apache) groups=502(apache) [root@NFS_Server ~]# setfacl -m u:apache:rwx /home/test
[root@NFS_Server ~]# vim /etc/exports

/home/test          192.168.1.5(rw)

[root@NFS_Server ~]# exportfs -r

[root@NFS_Server ~]# ll
/home/test/

total 0

-rw-r--r--. 1 root root 0 May
 4 05:13 ab.sh

[ON Client]

[root@NFS_Client ~]# mkdir /usr/local/live

[root@NFS_Client ~]# showmount -e 192.168.1.4

Export list for 192.168.1.4:

/home/test 192.168.1.5

[root@NFS_Client ~]# mount -t nfs 192.168.1.4:/home/test /usr/local/live/

[root@NFS_Client ~]# ll

total 24

-rw-------.
1 root root    969 Apr 23 15:12 anaconda-ks.cfg

-rw-r--r--. 1 root root 15989 Apr 23 15:12 install.log

-rw-r--r--. 1 root root  3482 Apr 23
15:10 install.log.syslog

[root@NFS_Client ~]# cd /usr/local/live/
[root@NFS_Client live]# ll

total 0

-rw-r--r--. 1 root root 0 May
 4
 2014 ab.sh
用户切换验证,起作用的是 uid 号而不是用户名称 [root@NFS_Client ~]# useradd apache

uid=501(apache) gid=501(apache) groups=501(apache)

[root@NFS_Client ~]# passwd apache Changing password for user apache. New password:

BAD PASSWORD: it is
based on a dictionary word

BAD PASSWORD: is too simple

Retype new password:

passwd: all authentication tokens updated successfully.

[root@NFS_Client ~]# su apache

[apache@NFS_Client root]$ id

uid=501(apache) gid=501(apache) groups=501(apache)

context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

[apache@NFS_Client root]$ whoami

apache

[apache@NFS_Client root]$ cd /usr/local/live/

[apache@NFS_Client live]$ ll

total 0

-rw-r--r--. 1 root root 0 May
 4 05:13 ab.sh

-rw-rw-r--. 1  530
 530 0 May
 4 05:23 ddd.sh

[apache@NFS_Client live]$ touch ^C

[apache@NFS_Client live]$ ll
total 0

-rw-r--r--. 1 root root 0 May
 4 05:13 ab.sh

[apache@NFS_Client live]$ touch cd.sh

touch: cannot touch `cd.sh': Permission denied

[apache@NFS_Client live]$ su

[root@NFS_Client live]# useradd -u 502 allentuns

[root@NFS_Client live]# id allentuns

uid=502(allentuns) gid=502(allentuns) groups=502(allentuns)
[root@NFS_Client live]# passwd allentuns

Changing password for user allentuns.

New password:

BAD PASSWORD: it is
based on a dictionary word

Retype new password:

passwd: all authentication tokens updated successfully.

[root@NFS_Client live]# su allentuns

[allentuns@NFS_Client live]$ id

uid=502(allentuns) gid=502(allentuns) groups=502(allentuns)

context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

[allentuns@NFS_Client live]$ whoami

allentuns

[allentuns@NFS_Client live]$ touch cd.sh

[allentuns@NFS_Client live]$ ll

total 0

-rw-r--r--. 1 root root 0 May
 4 05:13 ab.sh

-rw-rw-r--. 1  530
 530 0 May
 4
 2014 cd.sh

[ON Server]
[allentuns@NFS_Client live]$ ll total 0

-rw-r--r--. 1 root root 0 May
 4 05:13 ab.sh

-rw-rw-r--. 1  530
 530 0 May
 4 05:28 cd.sh

---End---

实例三其实与实例二大同小异,主要验证 uid 和 gid 对 nfs 权限的作用

linux NFS 实例的更多相关文章

  1. Linux NFS服务器的简明配置6.8

    Linux NFS服务器的简明配置6.8   Linux NFS服务器的简明配置 一.NFS服务简介 NFS 是Network File System的缩写,即网络文件系统.一种使用于分散式文件系统的 ...

  2. Linux多线程实例练习 - pthread_cancel()

    Linux多线程实例练习 - pthread_cancel 1.代码 xx_pthread_cancel.c #include <pthread.h> #include <stdio ...

  3. Linux多线程实例练习 - pthread_exit() 与 pthread_join()

    Linux多线程实例练习 - pthread_exit 与 pthread_join pthread_exit():终止当前线程 void pthread_exit(void* retval); pt ...

  4. Linux多线程实例练习 - pthread_create()

    Linux多线程实例练习 pthread_create():创建一个线程 int pthread_create(pthread_t *tidp, const pthread_attr_t *attr, ...

  5. Linux NFS服务器的安装与配置方法(图文详解)

    这篇文章主要介绍了Linux NFS服务器的安装与配置方法(图文详解),需要的朋友可以参考下(http://xb.xcjl0834.com) 一.NFS服务简介 NFS 是Network File S ...

  6. Linux NFS挂载

    Linux NFS挂载 一.NFS挂载 192.25.10.101/home/sharedata/azkaban/ODS_HS08 挂载到 192.25.10.102/home/data_azkaba ...

  7. Linux:进程实例信息(/proc)

    https://blog.csdn.net/test1280/article/details/73632333 Linux:进程实例信息(/proc) 问几个问题: 1.怎么知道一个进程对应哪个可执行 ...

  8. Linux NFS Root and PXE-Boot

    Linux NFS Root and PXE-Boot November 6, 2006 Home· Linux Linux kernel hacking and test running on th ...

  9. linux nfs服务配置挂载以及oracle使用nfs存储挂载注意事项

    服务端共享目录 /home/XXX/nfs_shared 172.16.22.0/24(rw,no_root_squash) service nfs restart 常用命令: 查看所有nfs共享目录 ...

随机推荐

  1. python学习之路(22)

    使用模块 Python本身就内置了很多非常有用的模块,只要安装完毕,这些模块就可以立刻使用. 我们以内建的sys模块为例,编写一个hello的模块: #!/usr/bin/env python # - ...

  2. wannafly 练习赛10 E 数列查找(莫队+分块分块分块......)

    链接:https://www.nowcoder.net/acm/contest/58/E 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit ...

  3. k8s中pod内dns无法解析的问题

    用k8s创建了pod,然后进入pod后,发现在pod中无法解析www.baidu.com,也就是出现了无法解析外面的域名的问题.经过高人指点,做个小总结.操作如下. 一,将CoreDNS 的Confi ...

  4. SpringMVC前端控制器以.html后缀拦截,访问接口返回406问题

    原因: spring监测到是.html来访问,它就会认为需要返回的是html页面.如果返回的不是html,会报406错误 解决: 提供多种后缀拦截方式,工程里web.xml配置 分析: HTTP 40 ...

  5. @清晰掉 C++ 中的 enum 结构在内存中是怎么存储的?

     C++ 中的 enum 结构在内存中是怎么存储的? C++ C++ 中的 enum 结构在内存中是怎么存储的?里面存储的是常量值吗?   关于占用内存的大小,enum类型本身是不占内存的,编译器直接 ...

  6. curl下载文件时自动创建目录

    有时候需要自动创建多级目录 按照如下格式即可 curl -o d:/lei/demo/test.jpg --create-dirs http://img.7160.com/uploads/allimg ...

  7. [VBA]批量新建指定名称的工作表

    sub 批量新建指定名称的工作表() Dim i As Integer For i = 2 To 10    '根据实际情况修改i大小 Worksheets.Add after:=Worksheets ...

  8. Jest 里面需要注意的几个小细节

    概述 最近学 jest ,有一些细节记录下来,供以后开发时参考,相信对其他人也有用. import 提升 ES6 的 import 会自动提升到文档前面,所以下面的 import 会提升到前面. le ...

  9. 阶段3 1.Mybatis_11.Mybatis的缓存_7 触发清空一级缓存的情况

    如果数据库的数据和一级缓存的数据不一致了,怎么做到同步的呢? 增加一个更新 用户信息的方法 增加更新的节点配置 测试类增加测试方法.先查询id为41的 然后更新了41的数据.再次查询41的数据 先把更 ...

  10. 阶段3 1.Mybatis_09.Mybatis的多表操作_5 完成user的一对多查询操作

    定义List<Account> accounts,生成getter和setter 复制AccountTest类改名UserTest类 修改测试类 还没封装所以Account的list都是n ...