1、当用户xiaoming对/testdir 目录无执行权限时,意味着无法做哪些操作?

无法cd切换进入此目录,无法创建文件,无法删除文件,无法查看里面文件的内容,只能ls列出目录下的内容

2、当用户xiaoqiang对/testdir 目录无读权限时,意味着无法做哪些操作?

无法ls查看目录下的内容

3、当用户wangcai 对/testdir 目录无写权限时,该目录下的只读文件file1是否可修改和删除?

无法修改也无法删除

4、复制/etc/fstab文件到/var/tmp下,设置文件所有者为wangcai读写权限,所属组为sysadmins组有读写权限,其他人无权限。

[root@localhost testdir]# cp /etc/fstab /var/tmp/

[root@localhost testdir]# chmod 660 /var/tmp/fstab

[root@localhost testdir]# chown wangcai.sysadmins /var/tmp/fstab

[root@localhost testdir]# ll /var/tmp/fstab

-rw-rw----. 1 wangcai sysadmins 595 Aug  3 15:29 /var/tmp/fstab

5、误删除了用户wangcai的家目录,请重建并恢复该用户家目录及相应的权限属性

[root@localhost ~]# cp -r /etc/skel/ /home/wangcai

[root@localhost ~]# chown -R wangcai.wangcai /home/wangcai

[root@localhost ~]# chmod 700 /home/wangcai

[root@localhost ~]# chmod 644 /home/wangcai/.bash

.bash_logout   .bash_profile  .bashrc

[root@localhost ~]# chmod 644 /home/wangcai/.bash*

[root@localhost ~]# ll /home/wangcai/ -a

total 12

drwx------. 3 wangcai wangcai  74 Aug  3 15:31 .

drwxr-xr-x. 6 root    root     52 Aug  3 15:31 ..

-rw-r--r--. 1 wangcai wangcai  18 Aug  3 15:31 .bash_logout

-rw-r--r--. 1 wangcai wangcai 193 Aug  3 15:31 .bash_profile

-rw-r--r--. 1 wangcai wangcai 231 Aug  3 15:31 .bashrc

drwxr-xr-x. 4 wangcai wangcai  37 Aug  3 15:31 .mozilla

6、在/data/testdir里创建的新文件自动属于g1组,组g2的成员如:alice能对这些新文件有读写权限,组g3的成员如:tom只能对新文件有读权限,其它用户(不属于g1,g2,g3)不能访问这个文件夹。

[root@localhost ~]# id alice

uid=1006(alice) gid=1010(alice) groups=1010(alice),1008(g2)

[root@localhost ~]# id tom

uid=1007(tom) gid=1011(tom) groups=1011(tom),1009(g3)

[root@localhost ~]# id mage

uid=1004(mage) gid=1004(mage) groups=1004(mage)

[root@localhost ~]# mkdir -p /data/testdir

[root@localhost ~]# chown :g1 /data/testdir

[root@localhost ~]# chmod g+wsx /data/testdir

[root@localhost ~]# ll -d /data/testdir

drwxrwsr-x. 2 root g1 6 Aug  3 16:43 /data/testdir

[root@localhost ~]# setfacl -m d:g:g2:rw /data/testdir

[root@localhost ~]# setfacl -m d:g:g3:r /data/testdir

[root@localhost ~]# setfacl -m g:g2:rwx /data/testdir

[root@localhost ~]# setfacl -m g:g3:r-x /data/testdir

[root@localhost ~]# setfacl -m o:--- /data/testdir

[root@localhost ~]# getfacl /data/testdir

getfacl: Removing leading '/' from absolute path names

# file: data/testdir

# owner: root

# group: g1

# flags: -s-

user::rwx

group::rwx

group:g2:rwx

group:g3:r-x

mask::rwx

other::---

default:user::rwx

default:group::rwx

default:group:g2:rw-

default:group:g3:r--

default:mask::rwx

default:other::r-x

[root@localhost ~]# su alice

[alice@localhost root]$ cd /data/testdir/

[alice@localhost testdir]$ echo aaa > aaa

[alice@localhost testdir]$ cat aaa

aaa

[alice@localhost testdir]$ ll

total 8

-rw-rw-r--+ 1 alice g1 4 Aug  3 16:46 aaa

[alice@localhost testdir]$ exit

exit

[root@localhost ~]# su tom

[tom@localhost root]$ cd /data/testdir/

[tom@localhost testdir]$ ll

total 8

-rw-rw-r--+ 1 alice g1 4 Aug  3 16:46 aaa

[tom@localhost testdir]$ cat aaa

aaa

[tom@localhost testdir]$ echo aaaaa > aaa

bash: aaa: Permission denied

[tom@localhost testdir]$ echo aaaaa > tom

bash: tom: Permission denied

[tom@localhost testdir]$ ll

total 8

-rw-rw-r--+ 1 alice g1 4 Aug  3 16:46 aaa

[tom@localhost testdir]$ exit

exit

[root@localhost ~]# su mage

[mage@localhost root]$ cd /data/testdir/

bash: cd: /data/testdir/: Permission denied

[root@localhost ~]# setfacl -m d:o:--- /data/testdir/

[root@localhost ~]# getfacl /data/testdir/

getfacl: Removing leading '/' from absolute path names

# file: data/testdir/

# owner: root

# group: g1

# flags: -s-

user::rwx

group::rwx

group:g2:rwx

group:g3:r-x

mask::rwx

other::---

default:user::rwx

default:group::rwx

default:group:g2:rw-

default:group:g3:r--

default:mask::rwx

default:other::---

7、创建组sales,gid 3000,passwd:centos,sales admins:user2将用户user1,user2,user3加入到sales辅助组,希望user1 创建新文件 默认的所属组为sales,user2将用户user3从sales组移除,删除sales,user1,users。

[root@localhost ~]# groupadd -g 3000 sales

[root@localhost ~]# gpasswd sales

Changing the password for group sales

New Password:    ###centos

Re-enter new password:   ###centos

[root@localhost ~]# gpasswd -A user2 sales\

> ^C

[root@localhost ~]# gpasswd -A user2 sales

[root@localhost ~]# gpasswd -a user1 sales

Adding user user1 to group sales

[root@localhost ~]# gpasswd -a user2 sales

Adding user user2 to group sales

[root@localhost ~]# gpasswd -a user3 sales

Adding user user3 to group sales

[root@localhost ~]# groupmems -g sales -l

user1  user2  user3

[root@localhost ~]# newgrp sales user1

[root@localhost ~]# su user1

[user1@localhost root]$ cd

[user1@localhost ~]$ touch user1

[user1@localhost ~]$ ll user1

-rw-rw-r--. 1 user1 user1 0 Aug  3 17:21 user1

[user1@localhost ~]$ newgrp sales user1

[user1@localhost ~]$ touch user2

[user1@localhost ~]$ ll user2

-rw-r--r--. 1 user1 sales 0 Aug  3 17:21 user2

[user1@localhost ~]$ exit

exit

[user1@localhost ~]$ exit

exit

[root@localhost ~]# su user2

[user2@localhost root]$ gpasswd -d user3 sales

Removing user user3 from group sales

[user2@localhost root]$ exit

exit

[root@localhost ~]# gpasswd -d user1

Usage: gpasswd [option] GROUP

Options:

-a, --add USER                add USER to GROUP

-d, --delete USER             remove USER from GROUP

-h, --help                    display this help message and exit

-Q, --root CHROOT_DIR         directory to chroot into

-r, --delete-password         remove the GROUP's password

-R, --restrict                restrict access to GROUP to its members

-M, --members USER,...        set the list of members of GROUP

-A, --administrators ADMIN,...

set the list of administrators for GROUP

Except for the -A and -M options, the options cannot be combined.

[root@localhost ~]# gpasswd -d user1 sales

Removing user user1 from group sales

[root@localhost ~]# gpasswd -d user2 sales

Removing user user2 from group sales

[root@localhost ~]# groupmems -g sales -l

[root@localhost ~]# groupdel sales

原创文章,作者:nieda_linux,如若转载,请注明出处:http://www.178linux.com/29408

Linux运行权限1009无标题,Linux权限管理练习相关推荐

  1. LINUX底层文件1008无标题,Linux系统下常见问题的解决方法

    一.系统问题 1.系统无法启动 可能问题是MBR受损或GRUB错误.可考虑两种方案:1 进入救援模式rescue mode,编辑/boot/grub/下的menu.lst .2 修复MBR,备份MBR ...

  2. linux 运行java工程师_java工程师linux命令,这篇文章就够了

    精彩内容推荐 shell简介 1.1 shell家族 shell:命令解释器,根据输入的命令执行相应命令. 察看当前系统下有哪些shell: cat /etc/shells 察看当前系统正在使用的sh ...

  3. vs项目移植到linux运行,VS2008项目移植到Linux

    不少人都遇到过这种情况:在Windows下用Visual Studio工具开发的程序需要移植到Linux系统中,做成Linux版本的,但程序比较大,在Linux上又离不开Make,手动编写Makefi ...

  4. 深度linux运行windows游戏,在deepin linux系统中手动安装windows游戏的小技巧

    本文介绍在deepin linux系统中手动安装windows游戏的小技巧.其实现在wine很好用了,基本dx9的游戏都能玩,但是有些RA2则效果一般,不是很好.关于deepin-wine的版本低有些 ...

  5. linux运行好麻烦,解析用Linux非常困难、必须用命令行、很老又丑陋及无法运行游戏...

    很多刚接触Linux的人都有四大疑问:使用Linux非常困难.在Linux中,您必须使用命令行.Linux很老又丑陋.Linux无法运行计算机游戏,本文为您解析,打消您对Linux的误解. 前言 对于 ...

  6. corssover linux运行无效,使用 CrossOver 在 Linux运行 Windows 软件(金测OK)

    使用 CrossOver 在 Linux运行 Windows 软件 即便是最忠实的 Linux 用户,有时候也需要运行一下 Windows  软件.有的用户为此保留了一台旧的 Windows PC,有 ...

  7. android教程1009无标题,Android ActionBarActivity设置全屏无标题实现方法总结_Android_脚本之家...

    Android  ActionBarActivity设置全屏无标题实现方法总结 前言: 新建的Activity继承自ActionBarActivity,设置全屏无标题本来很简单的事,但是没想到app竟 ...

  8. linux 下 mount 挂载 无写文件权限问题解决

    1. 首先确保 windows下面的共享目录开了用户的读写权限 2. 在挂载命令中要加  dir_mode=0777,file_mode=0777, 完整的语法: mount -t cifs -o  ...

  9. linux监听端口无响应,linux – tomcat运行,但是8080端口没有响应

    我已经通过ssh在 linux x64机器上安装了sun jdk 1.6 x64和tomcat,我没有root权限,所以我安装在我的家庭目录中. 我设法成功运行tomcat,但如果我尝试输入mydom ...

  10. linux安装软件命令1003无标题,Linux下软件安装

    正则表达式基础 一.实验介绍 1.1 实验内容 虽然我们这一节的标题是正则表达式,但实际这一节实验只是介绍grep,sed,awk这三个命令,而正则表达式作为这三个命令的一种使用方式(命令输出中可以包 ...

最新文章

  1. 11.保存登录状态与注销功能
  2. 你的网站添加X-UA-Compatible meta标签了吗?
  3. 科大星云诗社动态20210327
  4. 影子场vs.属性访问器接口第2轮
  5. magento SEO
  6. TreeView控件问题汇总
  7. 配置ssd为缓存_SSD小讲堂丨新电脑剪视频还卡?原因给你们找到了!
  8. MySQL · 特性分析 · 执行计划缓存设计与实现
  9. sourceMap到底是个啥玩意?
  10. 【转】C# 过滤HTML,脚本,数据库关键字,特殊字符
  11. java 项目启动后页面乱码_java生成的Html打开后展示乱码
  12. python爬虫四(cookie,代理池,模拟登录(打码))
  13. 【Android容器组件—AdapterView】
  14. 注册OCX控件并在VS2013的mfc程序中使用及常见问题总结
  15. 世界五大学习方法之费曼技巧
  16. 计算机软件系统的三个层次,计算机软硬件系统
  17. 机器学习中数据缺失值处理方法
  18. vuepress-theme-reco的安装与使用
  19. 投资,不能也不想做的太复杂
  20. Intellij IDEA Spring Configuration check

热门文章

  1. 【基础教程】Python的特点(优点和缺点)
  2. 从高排到低变成小楼梯儿歌_春季学期幼儿园常规儿歌律动,收藏了就能用上
  3. 前端个人长期的学习目标
  4. MAC-重新安装系统的三种方法
  5. 存款利息的计算,有1000元,想存五年,可按照五种办法存:
  6. 商品进销差价_零售企业商品进销差价的核算
  7. vue 前端获取用户登录地址 ip 设备型号
  8. 如何搭建个人私有云盘
  9. 《私募股权基金投资基础知识》---第六章
  10. AES256加解密与异常处理