LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 741|回复: 5

谁能给个/etc/sudoers文件呀,贴出来也行亚

[复制链接]
发表于 2009-4-27 23:35:54 | 显示全部楼层 |阅读模式
谁能给个/etc/sudoers文件呀,贴出来也行亚   

(已解决)
发表于 2009-4-27 23:41:15 | 显示全部楼层
估计楼主是希望在执行一些管理命令时不需要 su 切换吧?
我自己的改了一下,普通用户可以使用 sudo 命令且不需要密码提示:
另外,需要编辑 /etc/group 文件,把你的普通用户添加到 wheel 组里面,比如 wheel:x:10:lovefruit
----------------
# Uncomment to allow people in group wheel to run all commands
%wheel        ALL=(ALL) ALL

# Same thing without a password
%wheel        ALL=(ALL) NOPASSWD: ALL
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-4-27 23:53:12 | 显示全部楼层
我用普通帐号sudo 出现这个Gtk-WARNING **: cannot open display:


艾,到网上找两个下,结果没备份sudo崩了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-4-27 23:59:22 | 显示全部楼层
能把前面几行贴出来马
回复 支持 反对

使用道具 举报

发表于 2009-4-28 00:02:33 | 显示全部楼层
原版的:
  1. # sudoers file.
  2. #
  3. # This file MUST be edited with the 'visudo' command as root.
  4. # Failure to use 'visudo' may result in syntax or file permission errors
  5. # that prevent sudo from running.
  6. #
  7. # See the sudoers man page for the details on how to write a sudoers file.
  8. #
  9. # Host alias specification
  10. # User alias specification
  11. # Cmnd alias specification
  12. # Defaults specification
  13. # Prevent environment variables from influencing programs in an
  14. # unexpected or harmful way (CVE-2005-2959, CVE-2005-4158, CVE-2006-0151)
  15. Defaults always_set_home
  16. Defaults env_reset
  17. # Change env_reset to !env_reset in previous line to keep all environment variables
  18. # Following list will no longer be necessary after this change
  19. Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE"
  20. # Comment out the preceding line and uncomment the following one if you need
  21. # to use special input methods. This may allow users to compromise  the root
  22. # account if they are allowed to run commands without authentication.
  23. #Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
  24. # In the default (unconfigured) configuration, sudo asks for the root password.
  25. # This allows use of an ordinary user account for administration of a freshly
  26. # installed system. When configuring sudo, delete the two
  27. # following lines:
  28. Defaults targetpw   # ask for the password of the target user i.e. root
  29. ALL        ALL=(ALL) ALL   # WARNING! Only use this together with 'Defaults targetpw'!
  30. # Runas alias specification
  31. # User privilege specification
  32. root        ALL=(ALL) ALL
  33. # Uncomment to allow people in group wheel to run all commands
  34. %wheel        ALL=(ALL) ALL
  35. # Same thing without a password
  36. %wheel        ALL=(ALL) NOPASSWD: ALL
  37. # Samples
  38. # %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
  39. # %users  localhost=/sbin/shutdown -h now
  40. beyes@linux-beyes:~> uname -a
  41. Linux linux-beyes 2.6.27.21-0.1-pae #1 SMP 2009-03-31 14:50:44 +0200 i686 i686 i386 GNU/Linux
  42. beyes@linux-beyes:~> rpm -q gcc
  43. gcc-4.3-34.168
  44. beyes@linux-beyes:~> cat /etc/sudoers.bak
  45. cat: /etc/sudoers.bak: 权限不够
  46. beyes@linux-beyes:~> sudo cat /etc/sudoers.bak
  47. # sudoers file.
  48. #
  49. # This file MUST be edited with the 'visudo' command as root.
  50. # Failure to use 'visudo' may result in syntax or file permission errors
  51. # that prevent sudo from running.
  52. #
  53. # See the sudoers man page for the details on how to write a sudoers file.
  54. #
  55. # Host alias specification
  56. # User alias specification
  57. # Cmnd alias specification
  58. # Defaults specification
  59. # Prevent environment variables from influencing programs in an
  60. # unexpected or harmful way (CVE-2005-2959, CVE-2005-4158, CVE-2006-0151)
  61. Defaults always_set_home
  62. Defaults env_reset
  63. # Change env_reset to !env_reset in previous line to keep all environment variables
  64. # Following list will no longer be necessary after this change
  65. Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE"
  66. # Comment out the preceding line and uncomment the following one if you need
  67. # to use special input methods. This may allow users to compromise  the root
  68. # account if they are allowed to run commands without authentication.
  69. #Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
  70. # In the default (unconfigured) configuration, sudo asks for the root password.
  71. # This allows use of an ordinary user account for administration of a freshly
  72. # installed system. When configuring sudo, delete the two
  73. # following lines:
  74. Defaults targetpw   # ask for the password of the target user i.e. root
  75. ALL        ALL=(ALL) ALL   # WARNING! Only use this together with 'Defaults targetpw'!
  76. # Runas alias specification
  77. # User privilege specification
  78. root        ALL=(ALL) ALL
  79. # Uncomment to allow people in group wheel to run all commands
  80. # %wheel        ALL=(ALL) ALL
  81. # Same thing without a password
  82. # %wheel        ALL=(ALL) NOPASSWD: ALL
  83. # Samples
  84. # %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
  85. # %users  localhost=/sbin/shutdown -h now
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-4-28 00:11:08 | 显示全部楼层
谢谢,
又回到了(<unknown>:22748): Gtk-WARNING **: cannot open display:
回复 支持 反对

使用道具 举报

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

本版积分规则

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