Bo's Oracle Station

查看: 1407|回复: 0

课程第6次

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2019-7-16 20:05:48 | 显示全部楼层 |阅读模式
2019-07-16

管道出错:
  1. [root@desktop3 labs]# tty
  2. /dev/pts/0
  3. [root@desktop3 labs]# echo "Hello World" |tee  /dev/pts/0  | cut -f 2 -d ' '
  4. Hello World
  5. World
复制代码
  1. <p>## Sudoers allows particular users to run various commands as
  2. ## the root user, without needing the root password.
  3. ##
  4. ## Examples are provided at the bottom of the file for collections
  5. ## of related commands, which can then be delegated out to particular
  6. ## users or groups.
  7. ##
  8. ## This file must be edited with the 'visudo' command.

  9. ## Host Aliases
  10. ## Groups of machines. You may prefer to use hostnames (perhaps using
  11. ## wildcards for entire domains) or IP addresses instead.
  12. # Host_Alias     FILESERVERS = fs1, fs2
  13. # Host_Alias     MAILSERVERS = smtp, smtp2

  14. ## User Aliases
  15. ## These aren't often necessary, as you can use regular groups
  16. ## (ie, from files, LDAP, NIS, etc) in this file - just use %groupname
  17. ## rather than USERALIAS
  18. # User_Alias ADMINS = jsmith, mikem
  19. User_Alias STD = student

  20. ## Command Aliases
  21. ## These are groups of related commands...

  22. ## Networking
  23. # Cmnd_Alias NETWORKING = /sbin/route, /sbin/ifconfig, /bin/ping, /sbin/dhclient, /usr/bin/net, /sbin/iptables, /usr/bin/rfcomm, /usr/bin/wvdial, /sbin/iwconfig, /sbin/mii-tool

  24. ## Installation and management of software
  25. # Cmnd_Alias SOFTWARE = /bin/rpm, /usr/bin/up2date, /usr/bin/yum

  26. ## Services
  27. # Cmnd_Alias SERVICES = /sbin/service, /sbin/chkconfig, /usr/bin/systemctl start, /usr/bin/systemctl stop, /usr/bin/systemctl reload, /usr/bin/systemctl restart, /usr/bin/systemctl status, /usr/bin/systemctl enable, /usr/bin/systemctl disable

  28. ## Updating the locate database
  29. # Cmnd_Alias LOCATE = /usr/bin/updatedb

  30. ## Storage
  31. # Cmnd_Alias STORAGE = /sbin/fdisk, /sbin/sfdisk, /sbin/parted, /sbin/partprobe, /bin/mount, /bin/umount

  32. ## Delegating permissions
  33. # Cmnd_Alias DELEGATING = /usr/sbin/visudo, /bin/chown, /bin/chmod, /bin/chgrp

  34. ## Processes
  35. # Cmnd_Alias PROCESSES = /bin/nice, /bin/kill, /usr/bin/kill, /usr/bin/killall

  36. ## Drivers
  37. # Cmnd_Alias DRIVERS = /sbin/modprobe</p><p>
  38. </p><p>Cmnd_Alias  USERMODL=/usr/sbin/usermod -L user1

  39. # Defaults specification

  40. #
  41. # Refuse to run if unable to disable echo on the tty.
  42. #
  43. Defaults   !visiblepw

  44. #
  45. # Preserving HOME has security implications since many programs
  46. # use it when searching for configuration files. Note that HOME
  47. # is already set when the the env_reset option is enabled, so
  48. # this option is only effective for configurations where either
  49. # env_reset is disabled or HOME is present in the env_keep list.
  50. #
  51. Defaults    always_set_home
  52. Defaults    match_group_by_gid

  53. # Prior to version 1.8.15, groups listed in sudoers that were not
  54. # found in the system group database were passed to the group
  55. # plugin, if any. Starting with 1.8.15, only groups of the form
  56. # %:group are resolved via the group plugin by default.
  57. # We enable always_query_group_plugin to restore old behavior.
  58. # Disable this option for new behavior.
  59. Defaults    always_query_group_plugin

  60. Defaults    env_reset
  61. Defaults    env_keep =  "COLORS DISPLAY HOSTNAME HISTSIZE KDEDIR LS_COLORS"
  62. Defaults    env_keep += "MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE"
  63. Defaults    env_keep += "LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES"
  64. Defaults    env_keep += "LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE"
  65. Defaults    env_keep += "LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY"

  66. #
  67. # Adding HOME to env_keep may enable a user to run unrestricted
  68. # commands via sudo.
  69. #
  70. # Defaults   env_keep += "HOME"

  71. Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin

  72. ## Next comes the main part: which users can run what software on
  73. ## which machines (the sudoers file can be shared between multiple
  74. ## systems).
  75. ## Syntax:
  76. ##
  77. ##         user        MACHINE=COMMANDS
  78. ##
  79. ## The COMMANDS section may have other options added to it.
  80. ##
  81. ## Allow root to run any commands anywhere
  82. root        ALL=(ALL)         ALL
  83. STD     ALL=(ALL)      USERMODL

  84. ## Allows members of the 'sys' group to run networking, software,
  85. ## service management apps and more.
  86. # %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS

  87. ## Allows people in group wheel to run all commands
  88. #%wheel        ALL=(ALL)        ALL

  89. ## Same thing without a password
  90. # %wheel        ALL=(ALL)        NOPASSWD: ALL

  91. ## Allows members of the users group to mount and unmount the
  92. ## cdrom as root
  93. # %users  ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom

  94. ## Allows members of the users group to shutdown this system
  95. # %users  localhost=/sbin/shutdown -h now

  96. ## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
  97. #includedir /etc/sudoers.d
  98. </p>
复制代码
  1. [root@desktop3 mail]# userdel user1
  2. [root@desktop3 mail]# cd /home/
  3. [root@desktop3 home]# ls -ld *
  4. drwxr-x---. 16 student wheel  4096 Jul 16 21:10 student
  5. drwx------.  6    1001 group1  160 Jul 16 21:10 user1
  6. drwx------.  5 user2   user2   143 Jul 16 22:14 user2
  7. [root@desktop3 home]# cd
  8. [root@desktop3 ~]# find / -nouser -o -nogroup
  9. find: ‘/proc/12077/task/12077/fd/5’: No such file or directory
  10. find: ‘/proc/12077/task/12077/fdinfo/5’: No such file or directory
  11. find: ‘/proc/12077/fd/6’: No such file or directory
  12. find: ‘/proc/12077/fdinfo/6’: No such file or directory
  13. /var/spool/mail/user1
  14. /home/user1
  15. /home/user1/.mozilla
  16. /home/user1/.mozilla/extensions
  17. /home/user1/.mozilla/plugins
  18. /home/user1/.bash_logout
  19. /home/user1/.bash_profile
  20. /home/user1/.bashrc
  21. /home/user1/.cache
  22. /home/user1/.cache/abrt
  23. /home/user1/.cache/abrt/lastnotification
  24. /home/user1/.config
  25. /home/user1/.config/abrt
  26. /home/user1/.bash_history
  27. /home/user1/user1.txt
  28. /home/user1/user1.d
  29. [root@desktop3 ~]#
复制代码




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-20 14:15 , Processed in 0.032412 second(s), 24 queries .

快速回复 返回顶部 返回列表