Change file permission by anothere user !

Guy's

we are in AIX 5.3

We have created two users user1 and user2 and they are under same group Staff Group

user1 will create file under /tmp/ and this is the permission of this file

-rw-r--r-- 1 user1 staff 1 Jun 13 09:47 file

user2 is under same group and when he try to change the permission of the same file he will get this message !

chmod 777 file
chmod: file: Operation not permitted.

I know the owner of the file is user1 but user1 and user2 are under same group so should have same permission

is there any clue to let the change of the permission be executed by user2 ?

Only the owner of a file and the user root (uid=0) are allowed to change the filemode of a file. It doesn't matter if you have write-access or not, execute-rights or not, etc..

If you have to change the filemode of a file owned by user1 via a command issued by user2 you might want to explore sudo and its possibilities.

Regarding your original question: works as designed.

I hope this helps.

bakunin

What about Umask option ?

I think this option will let the permission change of the file be allowed for everyone in the same group .

Do you have any idea about it and how it's work ?

Try...

cp file file.tmp &&\
mv file file.old &&\
mv file.tmp file &&\
rm file.old &&\
chmod 777 file

Ygor thank you for your trying

User1 is under staff group we need any one under staff group change the permission of any one in the same group without do copying , I think there is solution by Umask

Do you have any idea about Umask Option ?

"umask" will only change the filemode new files are being created with. I don't think there is a way without copying/modifying the file in Ygors way.

The alternative to copying would be to effectively become the user who owns the file, at least for the moment needed to change the filemode. This is what i had in mind when i suggested sudo. You could also use more extravagant (and surely far less reliable and less desirable) ways to achieve the same goal like suid-ed copies of shell executables and the like. I don't think these are of more than theoretical value.

I hope this helps.

bakunin

Why do you actually need to do? Would group-writeable permissions on the files and directories be sufficient?

Dear Ygor

Good idea but if the permission of the file like this

-rw------- 1 user1 staff 1 Jun 15 11:53 F2

We'll not be able to change the permission!

Is there any clue ?

what exactly is your problem and when/where you are getting issues...
So that we can try to solve it in some other way instead of chmod....

why dont you try as garethr said...

I have this File

-rw------- 1 user1 staff 1 Jun 15 11:53 File

The Owner of the file for user1 and the permissions read and write only for the Owner it self

The owner group of the file is staff , I want to let anyone in the group of staff to be able to change the permission or to take full control on the file to do what ever ..

I think my idea is clear is there any clue ?

If you don't have read permission then you can't do much unless you are root.

Is there any another clue will help us by Umask Option ?

Please stop posting same thing again & again. Read Bakunin's post regarding umask.

is there any conifgration on user1 need to be done to let the permission of any file created by user1 to be like this -rw-rw-r--

-rw-rw-r-- 1 user1 staff 1 Jun 17 17:09 File

to be able to copy it to take the owner ?

Yes, with "umask" you can change the default file mode with which new files are created. If the only thing you need is to have write access to the file from both users then set the umask so that files are created with "rw-rw----". Have a look at the umask man page for details on how to do so.

I hope this helps.

bakunin

At last some moderative remarks:

  1. If you need write access from two users then say so. You asked about changing the ownership of a file but now it seems to turn out you only need write access. Ask about what you want to achieve, not about what you think is necessary to achieve.

  2. I would appreciate it if you wouldn't send me notification-messages every time you write a post. As a moderator i do read every single thread here and i log on here on 9 out of 10 days at least once, on most days several times a day. Rest assured i will notice what you have written.