我想用sudo -i
而不是sudo -i
来在AIX系统上运行命令。 这样我可以确保像umask
这样的环境设置将是我正在运行该命令的用户的环境设置。
当进程以这种方式开始生成文件时,这些文件显然将其所有者/组设置为运行该进程的用户的所有者/组。
Sudo可以select指定用户(-u)和组(-g) 。 但是,当我尝试使用这些参数运行命令时,出现以下错误:
[johndoe@catchyname ~] # sudo -u 'foo' -g 'bar' ls Sorry, user johndoe is not allowed to execute '/usr/bin/ls' as foo:bar on catchyname.
用户被允许在/etc/sudoers
文件中的这个系统上运行任何东西。
我已经浏览了sudo
文档,并且search了很多网页,但还没有得到这个工作。
我错过什么或做错了什么?
man sudoers
说:
first Runas_List indicates which users the command may be run as via sudo's -u option. The second defines a list of groups that can be specified via sudo's -g option. If both Runas_Lists are specified, the command may be run with any combination of users and groups listed in their respective Runas_Lists. If only the first is specified, the command may be run as any user in the list but no -g option may be specified.
并进一步举例说明:
to allow dgb to run /bin/ls with either the user or group set to operator: dgb boulder = (operator : operator) /bin/ls