RHEL 5.7
visudo
vi /etc/sudoers
如果报错:sudo: sorry, you must have a tty to run sudo
注释掉sudo默认需要tty终端。
#Defaults requiretty
允许oracle使用sudo,不用输入密码
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
oracle ALL=(ALL) NOPASSWD: ALL
配置组的
## Allows people in group wheel to run all commands
# %wheel ALL=(ALL) ALL
## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
## Sudoers allows particular users to run various commands as ## the root user, without needing the root password. ## ## Examples are provided at the bottom of the file for collections ## of related commands, which can then be delegated out to particular ## users or groups. ## ## This file must be edited with the 'visudo' command. ## Host Aliases ## Groups of machines. You may prefer to use hostnames (perhap using ## wildcards for entire domains) or IP addresses instead. # Host_Alias FILESERVERS = fs1, fs2 # Host_Alias MAILSERVERS = smtp, smtp2 ## User Aliases ## These aren't often necessary, as you can use regular groups ## (ie, from files, LDAP, NIS, etc) in this file - just use %groupname ## rather than USERALIAS # User_Alias ADMINS = jsmith, mikem ## Command Aliases ## These are groups of related commands... ## Networking #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 ## Installation and management of software #Cmnd_Alias SOFTWARE = /bin/rpm, /usr/bin/up2date, /usr/bin/yum ## Services #Cmnd_Alias SERVICES = /sbin/service, /sbin/chkconfig ## Updating the locate database #Cmnd_Alias LOCATE = /usr/bin/updatedb ## Storage #Cmnd_Alias STORAGE = /sbin/fdisk, /sbin/sfdisk, /sbin/parted, /sbin/partprobe, /bin/mount, /bin/umount ## Delegating permissions #Cmnd_Alias DELEGATING = /usr/sbin/visudo, /bin/chown, /bin/chmod, /bin/chgrp ## Processes #Cmnd_Alias PROCESSES = /bin/nice, /bin/kill, /usr/bin/kill, /usr/bin/killall ## Drivers #Cmnd_Alias DRIVERS = /sbin/modprobe # Defaults specification # # Disable "ssh hostname sudo <cmd>", because it will show the password in clear. # You have to run "ssh -t hostname sudo <cmd>". # #Defaults requiretty # # Refuse to run if unable to disable echo on the tty. This setting should also be # changed in order to be able to use sudo without a tty. See requiretty above. # Defaults !visiblepw Defaults env_reset Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR \ LS_COLORS MAIL PS1 PS2 QTDIR USERNAME \ 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 \ _XKB_CHARSET XAUTHORITY" ## Next comes the main part: which users can run what software on ## which machines (the sudoers file can be shared between multiple ## systems). ## Syntax: ## ## user MACHINE=COMMANDS ## ## The COMMANDS section may have other options added to it. ## ## Allow root to run any commands anywhere root ALL=(ALL) ALL oracle ALL=(ALL) NOPASSWD: ALL ## Allows members of the 'sys' group to run networking, software, ## service management apps and more. # %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS ## Allows people in group wheel to run all commands # %wheel ALL=(ALL) ALL ## Same thing without a password # %wheel ALL=(ALL) NOPASSWD: ALL ## Allows members of the users group to mount and unmount the ## cdrom as root # %users ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom ## Allows members of the users group to shutdown this system # %users localhost=/sbin/shutdown -h now
相关推荐
DBA实战配置Linux sudo,sudo工具命令很关键,值得留意设置
linux常见操作命令及sudo配置服务升级手册.pdflinux常见操作命令及sudo配置服务升级手册.pdf
#1.root执行sudo时不需要输入密码(eudoers文件中有配置root ALL=(ALL) ALL这样一条规则) #2.欲切换的身份与执行者的身份相同,不需要输入密码 3./etc/sudoers文件设置为允许用户在不输入该用户的密码的情况下使用...
下面小编就为大家带来一篇Linux用户配置sudo权限(visudo)的方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
“Sudo”是Unix/Linux平台上的一个非常有用的工具,它允许系统管理员分配给普通用户一些合理的“权利”,让他们执行一些只有超级用户或其他特许用户才能完成的任务,或者编辑一些系统配置文件。这样以来,就不仅减少...
主要介绍了详解Linux下的sudo及其配置文件/etc/sudoers的详细配置的相关资料,需要的朋友可以参考下
设置了0积分,方便大家下载,安装教程:http://t.csdn.cn/q4eqx
很多公司Linux系统都会用到sudo来配置普通用户可以执行的超级用户权限,一是为了系统管理员更安全的操作系统,二是可以为研发人员提供可控的权限范围,下面就看一下我们在系统中常见的sudo配置文件。 代码如下: ...
在Linux系统上配置sudo的Ansible角色。 要求 去做。 角色变量 sudo_package :sudo包,按名称。使用sudo=ver固定到版本。默认为sudo 。 sudo_package_state :sudo软件包的安装状态。默认present 。 剧本范例 默认...
工作需要总结的,较简单,linux、HP-UX、AIX
在近的文章中,我们向你展示了 在 Linux 中设置 sudo 的十条 sudoers 实用配置]1以及让 sudo 在你输入错误的密码时“嘲讽”你,在本文中,我们发现了另一个 sudo 贴士,在 Ubuntu Linux 中使 sudo 密码会话(超时)更...
sudo默认配置文件是**/etc/sudoers** ,一般使用Linux指定编辑工具visudo ,此工具的好处是可以进行错误检查。在添加规则不符合语法规则时,保存退出时会提示给我们错误信息;配置好后,可以用切换到您授权的普通...
比如:运行一些像mount,halt,su之类的命令,或者编辑一些系统配置文件,像/etc/mtab,/etc /samba/smb.conf等。这样以来,就不仅减少了root用户的登陆次数和管理时间,也提高了系统安全性。一. sudo的特点 sudo...
这是一个关于linux2.4内核配置的文档 make menuconfig
然而近期曝出的一个提权漏洞,却直指 sudo 的一个安全策略隐患 —— 即便配置中明确不允许 root 用户访问,该漏洞仍可允许恶意用户或程序,在目标 Linux 系统上以 root 用户身份执行任意命令。 (题图 via Hacker ...
Linux基本防护措施 使用sudo分配管理权限 提高SSH服务安全 SELinux安全防护 加密与解密应用 使用AIDE做入侵检测 扫描与抓包分析 案例1:部署audit监控文件 案例2:加固常见服务的安全 案例3:使用diff和patch工具打...
ubuntu和win7共享文件夹设置方法: 先要在Ubuntu系统中安装一个软件:samba,在Ubuntu系统中打开终端命令行窗口,然后输入下面的命令就可安装samba:sudo apt-get install samba。
在Linux和其他类Unix操作系统中,只有root用户可以运行所有命令并在系统上执行某些关键操作,如安装和更新,删除包,创建用户和组,修改重要的系统配置文件等。 然而,承担root用户角色的系统管理员可以允许其他...