linux NFS 实例
为了证明是 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 实例的更多相关文章
- Linux NFS服务器的简明配置6.8
Linux NFS服务器的简明配置6.8 Linux NFS服务器的简明配置 一.NFS服务简介 NFS 是Network File System的缩写,即网络文件系统.一种使用于分散式文件系统的 ...
- Linux多线程实例练习 - pthread_cancel()
Linux多线程实例练习 - pthread_cancel 1.代码 xx_pthread_cancel.c #include <pthread.h> #include <stdio ...
- Linux多线程实例练习 - pthread_exit() 与 pthread_join()
Linux多线程实例练习 - pthread_exit 与 pthread_join pthread_exit():终止当前线程 void pthread_exit(void* retval); pt ...
- Linux多线程实例练习 - pthread_create()
Linux多线程实例练习 pthread_create():创建一个线程 int pthread_create(pthread_t *tidp, const pthread_attr_t *attr, ...
- Linux NFS服务器的安装与配置方法(图文详解)
这篇文章主要介绍了Linux NFS服务器的安装与配置方法(图文详解),需要的朋友可以参考下(http://xb.xcjl0834.com) 一.NFS服务简介 NFS 是Network File S ...
- Linux NFS挂载
Linux NFS挂载 一.NFS挂载 192.25.10.101/home/sharedata/azkaban/ODS_HS08 挂载到 192.25.10.102/home/data_azkaba ...
- Linux:进程实例信息(/proc)
https://blog.csdn.net/test1280/article/details/73632333 Linux:进程实例信息(/proc) 问几个问题: 1.怎么知道一个进程对应哪个可执行 ...
- 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 ...
- linux nfs服务配置挂载以及oracle使用nfs存储挂载注意事项
服务端共享目录 /home/XXX/nfs_shared 172.16.22.0/24(rw,no_root_squash) service nfs restart 常用命令: 查看所有nfs共享目录 ...
随机推荐
- 洛谷P1198 [JSOI2008]最大数(单点修改,区间查询)
洛谷P1198 [JSOI2008]最大数 简单的线段树单点问题. 问题:读入A和Q时,按照读入一个字符会MLE,换成读入字符串就可以了. #include<bits/stdc++.h> ...
- P1076 寻宝
P1076 寻宝 题解 这道题真是感人啊,废了蒟蒻一天的时间 关键 1. a[ k ][ ] 数组记录第k层有楼梯房间的编号 a[ k ][ 0 ] 第k层有几个有楼梯的房间 a[ k ][ i ] ...
- 搜索引擎、邮件营销、微信营销之营销方式大PK
经常有朋友问到这个问题,关于搜索引擎.邮件营销.微信营销三种网络营销方式的优劣势,用哪种营销方式比较好.下面我们跟随Focussend小编来看看这几种方式的优劣势. 搜索引擎 优势:1.传播速度快:2 ...
- Python学习之==>面向对象编程(一)
一.面向对象与面向过程 面向对象与面向过程是两种不同的编程范式,范式指的是按照什么方式去编程.去实现一个功能.不同的编程范式本质上代表对各种不同类型的任务采取不同的解决问题的思路. 1.面向过程编程 ...
- 【Python】我的豆瓣短评爬虫的多线程改写
对之前我的那个豆瓣的短评的爬虫,进行了一下架构性的改动.尽可能实现了模块的分离.但是总是感觉不完美.暂时也没心情折腾了. 同时也添加了多线程的实现.具体过程见下. 改动 独立出来的部分: MakeOp ...
- 【VS开发】C++调用外部程序
关于三个SDK函数:WinExec, ShellExecute,CreateProcess的其他注意事项:[1]定义头文件必须定义以下两个头文件: [cpp] view plain copy #inc ...
- BCD与ASCII码互转-C语言实现
/*BCD 与 ASCII码转换*/ /******************************************************************* 函数名: asc2bc ...
- 红帽学习笔记[RHCSA] 第三课[输出重定向、Vi编辑器]
第三课 关于Linux的输入输出 输入输出 0 stdin 标准输入 仅读取 1 stdout 标准输出 仅写入 2 stderr 标准错误 仅写入 3 filename 其他文件 读取和/或写入 输 ...
- centos7里创建用户和组
1.创建组distro,其GID为2019groupadd -g 2019 distro 2.创建用户mandriva, 其ID号为1005:基本组为distro useradd mandriva - ...
- 第8周课程总结&实验报告6
实验六 Java异常 实验目的 理解异常的基本概念: 掌握异常处理方法及熟悉常见异常的捕获方法. 实验要求 练习捕获异常.声明异常.抛出异常的方法.熟悉try和catch子句的使用. 掌握自定义异常类 ...