Re: How to change the Owner of a file



Rakesh Mishra wrote:
Hi folks
Can any body tell me how to change the owner of a file ??????

I have written this script .......

unless (chown $uid , $gid , $filename)
{
die "chown failed :$!";
}

this code will give me the error you can't change " permission denied "
can any body tell me , how to over come this error

bye
rakesh


Yes, you must the the recipient of the change, unless you have superuser privileges. In other words, you must be $uid. This is because many UNIX systems have quotas on how much data you can store. To "borrow" someone else's capacity, create your file and chown to someone who doesn't have much data stored. If it has read-access for everyone, you can get the file back by copying it. Unfortunately the new version of chown prevent this.


--

Just my 0.00000002 million dollars worth,
   --- Shawn

"Probability is now one. Any problems that are left are your own."
   SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_
.



Relevant Pages

  • Re: chgrp and chown
    ... contained in owner and group, ... --> cleared upon successful return from chown(). ... --> successfully invoked on a file that is not a regular file and one ... Version 7 and 4.3 BSD permit only ...
    (comp.os.linux.misc)
  • [PATCH] remove MAKEDEV scripts from scripts/
    ... and the distros already take care of ide ... echo " done" ... chown $OWNER $1$tmp1 ...
    (Linux-Kernel)
  • Re: loss of Preferences
    ... chown: invalid option -- r ... Try `chown --help' for more information. ... Change the owner and/or group of each FILE to OWNER and/or GROUP. ... the specifying OWNER:GROUP values ...
    (Ubuntu)
  • Re: chown SUPPORT_DOT broke in 4.9-REL
    ... if the owner of the file tries to add a different group, ... I tested and the chown owner:group works only if ... the owner is a member of the group of which they are a member. ... root or as the owner and used the chown for a group in which the ...
    (comp.unix.bsd.freebsd.misc)
  • Re: mounting issues
    ... The owner should stay the same when the drive ... for a normal user to use the chown command. ... trying to prevent "sudo mount" from doing it. ...
    (comp.os.linux.misc)