Linux 常用工具
YUM
yum init system
create local repo yum
centos 7 init system
FTP
How to Install and Configure vsftpd on CentOS 6
vsftp install on centos 7
Email
aliyun ecs install email
postfix smtp on centos
centos 6 postfix smpt test
GIT
gogs install centos6
git command example
git format markdown
HTTP Web
apache exampe
h5ai web php file server
apache vhosgts code debug
Nginx Web
nginx install from source
nginx set directory autoindex
autoindex with h5ai web
nginx install pugin ngx-fancyindex
proxy internal vhost to web
dynamic and static by nginx
proxy directory second by nginx
nginx proxy gogs web
jenkns proxy from nginx
ssl certify by nginx
nginx threads fix to 9x
NTP
linux install ntp use asia date
VNC
vnc remote desktop
x11vnc on centos6
Firewall
iptables on centos 7
centos7 firewalld config
Kernel
centos kernel packages
kernel update to 3.10 on centos 6
SYSCTL 内核配置参数分析
NFS
centos6 install nfs servers
mount nfs to linux
mount nfs on centos 6
centos6 nfs verify permissions
SSH
ssh keygen rsa to client
ssh config diffent
Network
centos 7 config net-tool debug ifconfig
debug network card up or down
Samba
samba install on centos 6
samba config example
VIM
VIM using example
本文档使用 MrDoc 发布
-
+
首页
centos6 nfs verify permissions
# verify nfs permission on centos 6 --- 上次说到在 centos 6 上面安装 NFS 服务。现在 说说在 /mnt 目录下的文件夹权限设置。 在客户机上看 结构。 # tree /mnt 看到的结果和nfs服务端的文件列表一样 <pre> # /mnt # ├── private # │ ├── fstab # │ └── protected # │ └── inittab # └── public # └── hosts </pre> # cp /mnt/public/hosts /tmp/ # cp /etc/passwd /mnt/public/ # cp /etc/shadow /mnt/private/ cp: 无法创建普通文件“/mnt/private/shadow”: 权限不够 发现root用户无法把文件拷贝到以读写权限导出的private共享。 原因: 客户端以root身份操作nfs资源的时候,nfs-server(服务端)把这个操作的身份映射成nfsnobody(普通用户),而远程nfs-server并没有让nfsnobody 可以写/share/private目录 服务端 # ll -d /share/private/ ```bash drwxr-xr-x 3 root root 4096 6月 6 20:45 /share/private/ ``` 为了能够实现让tom可以读写172.16.2.9:/share/private/protected目录,那么客户端必须也要存在一个和服务端相同uid的用户 # useradd -u 500 tester # id tester ```bash uid=500(tester) gid=500(tester) 组=500(tester) ``` # su - tester # cp /etc/passwd /mnt/private/protected/passwd nfs-server服务端并没有把普通用户的身份映射成nfsnobody,还是保留了原有身份 取消root身份的映射 一般不建议,因为取消之后,任何可以访问该共享的客户端都可以用root身份对读写共享有所有权限 ## 一、修改服务端的配置 # vim /etc/exports <hi #22b14c>/share/public *(rw) </hi> <hi #22b14c>/share/private 172.16.0.0/16(rw,no_root_squash)</hi> no_root_squash 不把root身份映射到普通用户 # exportfs -r ## 二、客户端验证 1、挂载 已经挂载就重新挂载 client: # umount 10.81.234.47:/share/private # mount 10.81.234.47:/share/private /mnt/private 2、使用root身份验证 client: # cp /etc/shadow /mnt/private/ # cp /etc/shadow /mnt/private/protected/shadow 服务端 # ll /share/private/protected/shadow ```bash ———- 1 root root 836 6月 6 21:50 /share/private/protected/shadow ``` 说明该文件在保存的时候,是使用root身份保存 保护读写共享下的文件不能被除了root以外的其他用户删除,只能文件拥有者本人可以删除 root可以删除读写共享下的文件(共享取消root身份映射),文件拥有者可以删除。 配置: 在nfs服务端上进行配置 # chmod o+t /share/public/ # ll /share/public/ -d rm -rf /mnt/public/bobbyfile rm: cannot remove `/mnt/public/bobbyfile': Operation not permitted tester可以删除自己的文件,但删除不了不属于自己的文件 nfs共享的持久化挂载(开机自动挂载) # vim /etc/fstab ```bash 172.16.2.9:/share/public /mnt/public nfs defaults,soft,intr 0 0 172.16.2.9:/share/private /mnt/private nfs defaults,soft,intr 0 0 ``` # mount -a # df -h 10.81.234.47:/share/public 9.7G 2.2G 7.0G 24% /mnt/public 10.81.234.47:/share/private 9.7G 2.2G 7.0G 24% /mnt/private
Bobby
2021年12月20日 23:45
分享文档
收藏文档
阅读
117
上一篇
下一篇
微信扫一扫
复制链接
手机扫一扫进行分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码