Operating System - HP-UX
1753302 Members
6812 Online
108792 Solutions
New Discussion юеВ

Re: File deletion question

 
SOLVED
Go to solution
dictum9
Super Advisor

File deletion question

Greetings,

If a file is not owned by a user but that user is in the group of the file, can the user delete the file if the permissions are set to group read only access but the directory group bit is set to "w".

Example:



$ whoami
supdba
$ ll
total 1
-rw-r----- 1 oracle dba 0 Feb 28 16:33 test1
$ rm test1
test1: 640 mode ? (y/n) y
$ ll test
test not found
5 REPLIES 5
Rick Garland
Honored Contributor

Re: File deletion question

Before answering this question, what is the supdba account? If the command 'id' is executed while logged in as supdba, what is returned?



Sandman!
Honored Contributor
Solution

Re: File deletion question

Hi,

Yes the "w" octal bit for the dir group will let you remove a file within it. Since a dir is nothing but a list of files, hence "w" access means one has the capability of modifying the list i.e. adding/removing items on that list) unless the sticky bit is set on that particular dir.

cheers!
Michael Schulte zur Sur
Honored Contributor

Re: File deletion question

Hi,

supdba can not change the file but as Sandman explained delete it fro the directory.

greetings,

Michael
Ajitkumar Rane
Trusted Contributor

Re: File deletion question

You need to have the write permission for the group, if you belong to the primary group dba, to delete the file.

At this time only the file owner oracle or root can modify / delete the file or its permission.


Rgds

Ajit
Amidsts difficulties lie opportunities
Bill Hassell
Honored Contributor

Re: File deletion question

Although not intuitive, the file's ownership and permission have almost no influence on whether the file can be deleted (or moved). The directory controls this function, so write permission grants rm or mv privileges. The exeption is for directories with the 'sticky' bit set. When set, only the file's owner can remove/move the file, assuming that the owner has write permission to the directory.


Bill Hassell, sysadmin