chown cannot change owner
I have a scenarion where I am user "A" on a Linux machine. There is another user "B" on this machine. I created a file in my home directory and tried to change the ownership to "B".
In this case I get the Operation not permitted error. Up to my understanding this seems to me as a security issues that linux is not allowing the file to owned by user B. Am I correct ? Is there anyway to achieve it except becoming a super user or suoders. |
You need to be root to change ownership of files. :) Unfortunately there's no solution other than to log in as root or using sudo (if it is configured correctly).
|
You need root permissions to change a file's owner. You can change the group ownership if you are a member.
If you copy a file from another directory, to your own, it will inherit your ownership. (If you have read rights) |
Harishankar in my scenario user A is the owner of the file and user A want to change the owner to user B.
|
Quote:
The reason for not allowing changing your own file ownership is because you could easily write a malicious script (just an example, nothing personal) and use it to access another user's files. Since that script is "owned" by the other user, it would have the permissions to scan the other user's home directories and access personal information etc. |
Quote:
Quote:
ownership. The rationale (to the best of my knowledge) behind this (the fact that one can't "disown" oneself of a file) is stemmed from systems with multiple users and user quotas; one could (if disowning was possible) if one was about to run out of space just make some files in an arbitrary place in the file-system where one happens to have write access files and make someone else the owner (who probably will never stumble across those, so the ownership doesn't matter too much as long as the group permissions are still fine). Cheers, Tink |
Sorry I made a mistake. Grossly misleading. A quick look at google confirms that most *nix implements chown that way. But there seem to be ways to bypass this behaviour on some distributions/OSes(use google, I won't help :))
|
All times are GMT -5. The time now is 11:48 PM. |