在 UNIX 中编辑文件的权限被拒绝
我有一个由 oracle
用户创建的具有 rw-r--r--
权限的文件,并且父文件夹具有 rwxrwsr-x
权限。现在,需要批量用户编辑该文件。但是,正如您所看到的,该文件只能由所有者(即 Oracle 用户)编辑。
我尝试使用 chmod 命令更改文件的权限,但批处理用户没有执行此命令的权限。
这个问题有解决办法吗?
我们能否在 UNIX 中进行一些配置,以便允许批处理用户编辑 oracle
用户创建的文件。
编辑:更正了父文件夹权限。之前我提到过它为 rwxrw-rx
I have a file created by oracle
user with permission rw-r--r--
and the parent folder has rwxrwsr-x
permission. Now, there is a requirement for batch user to edit this file. But, as you can see, the file can be edited only by the owner i.e Oracle user.
I tried using chmod
command to change the permission of the file but batch user is not having permission to execute this command.
Is there any fix for this issue?
Can we do some configuration in UNIX so that it allows batch user to edit the file created by oracle
user.
Edit: Corrected the parent folder permission. Earlier i mentioned it as rwxrw-r-x
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
“组”(rw-
) 的目录权限不常见(rwx
或rx
更为常见)。您无法识别文件属于哪个组,也无法识别目录属于哪个组,也无法识别批处理用户属于哪个组
,但这可能并不重要。目录引用权限更改后更新:假设该组可以读取该文件,并在该目录中创建文件,那么如果您的批处理用户属于拥有该目录的组,则该批处理用户可以使文件的副本(在编辑器中),删除原始文件,然后在目录中写回新文件。
您的系统支持 ACL(访问控制列表)吗?如果是这样,那么作为文件所有者的“oracle”用户可以授予批处理用户对该文件的读/写访问权限,即使正常的 Unix 权限并未表明这种情况会发生。
您能否说服“oracle”用户创建属于适当组(批处理用户也属于该组)并具有适当组权限的文件。
如果那里没有任何作用,那么您就会被简化为某种形式的 SUID 程序 - 也许是 SUID“oracle”或 SUID“root”。评论中提到了一个选项 - 带有一些模糊适当参数的 sudo 命令。
The directory permissions for 'group' (rw-
) are unusual (rwx
orr-x
would be more usual).You don't identify which group the file belongs to, nor which group the directory belongs to, nor which group(s) the batch user belongs to
, but it probably doesn't matter.Update after quoted permissions on directory changed: Given that the group can read the file, and create files in the directory, then if your batch user belongs to the group that owns the directory, the batch user can make a copy of the file (in the editor), remove the original file, and write back a new file in the directory.
Does your system support ACLs (access control lists)? If so, then the 'oracle' user as the file owner could grant the batch user read/write access to the file even though the normal Unix permissions don't show that it could happen.
Can you persuade the 'oracle' user to create the file belonging to an appropriate group (one which the batch user also belongs to) and with appropriate group permissions.
If nothing works there, then you are reduced to SUID programs in some shape or form - maybe SUID 'oracle' or SUID 'root'. One option was mentioned in a comment - the
sudo
command with some vaguely appropriate arguments.我注意到你在目录上设置了 +s 位......
如果将目录所有者更改为批处理用户的所有者,则任何新创建的文件的所有者都应归该用户所有,然后您可以对它们执行您想要的操作
I notice you have the +s bit set on the directory.....
if you change the directory owner to that of the batch user the owner of any newly created files should be owned by that user and you can then do what you want with them
如果您的批处理用户与 oracle 用户位于同一组,您可以执行以下操作:
这应该使文件对该组可写。
运行 UNIX 命令
groups
来确定用户所在的组,或检查/etc/passwd
、/etc/group
If your batch user is in the same group as the oracle user, you can do this:
This should make the file writable for the group.
Run the UNIX command
groups
to determine which groups a user is in, or check/etc/passwd
,/etc/group