Vivek
Vivek

Reputation: 4642

Permission denied to edit a file in UNIX

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

Upvotes: 0

Views: 3326

Answers (3)

Jonathan Leffler
Jonathan Leffler

Reputation: 753675

The directory permissions for 'group' (rw-) are unusual (rwx or r-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.

Upvotes: 2

Tilo
Tilo

Reputation: 33732

If your batch user is in the same group as the oracle user, you can do this:

chmod g+w filename

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

Upvotes: 0

Kevin Burton
Kevin Burton

Reputation: 11936

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

Upvotes: 0

Related Questions