Operating System - HP-UX
1834584 Members
3407 Online
110069 Solutions
New Discussion

can a file 's owner be chaged to another user?

 
faust2004
Regular Advisor

can a file 's owner be chaged to another user?

Hi, friend,

I login hp_un in user accout A, and change the owner of file x(owner is A) to user B,
it failed with:
chown: X: Not owner
why?
A and B is not root.

Thanks
sunny

5 REPLIES 5
Bill McNAMARA_1
Honored Contributor

Re: can a file 's owner be chaged to another user?

I don't have this problem:


kibo:ss7admin> ll
total 0
-rw-rw-rw- 1 ss7admin ocadmin 0 Aug 6 09:57 file1
kibo:ss7admin> id
uid=101(ss7admin) gid=101(ocadmin)
kibo:ss7admin> whereis chown
chown: /sbin/chown /usr/bin/chown /usr/share/man/man1.Z/chown.1 /usr/share/man/m
an2.Z/chown.2
kibo:ss7admin> what /usr/bin/chown
/usr/bin/chown:
$Revision: 80.1 $

kibo:ss7admin> chown ocmpadm:ocadmin file1
kibo:ss7admin> ll
total 0
-rw-rw-rw- 1 ocmpadm ocadmin 0 Aug 6 09:57 file1
kibo:ss7admin> type chown
chown is /usr/bin/chown
kibo:ss7admin> chown ss7admin:ocadmin file1
file1: Not owner
kibo:ss7admin> ll
total 0
-rw-rw-rw- 1 ocmpadm ocadmin 0 Aug 6 09:57 file1

Later,
Bill

It works for me (tm)
Steven Sim Kok Leong
Honored Contributor

Re: can a file 's owner be chaged to another user?

Hi,

Direct from the chown manpage, you will need to use setprivgrp. You can create a privgroup file in /etc i.e. /etc/privgroups as far as I recall off-hand for settings to stay permanent.

========================================
In order to change the owner or group, you must own the file and have the CHOWN privilege (see setprivgrp 1M)). If either command is invoked on a regular file by other than the superuser, the set-user-ID and set-group-ID bits of the file mode (04000 and 02000 respectively) are cleared. Note that a given user's or group's ability to use this
command can be restricted by setprivgrp (see setprivgrp(1M)).
========================================

Hope this helps. Regards.

Steven Sim Kok Leong
T G Manikandan
Honored Contributor

Re: can a file 's owner be chaged to another user?

Only the owner of the file or root can change the ownership.

your output is right.

The owner should provide or give the ownership to another person to a file.



Thanks
U.SivaKumar_2
Honored Contributor

Re: can a file 's owner be chaged to another user?

Hi,
Check the permissions of chown executable.
should be like this
-r-xr-xr-x 1 bin bin

regards,
U.SivaKumar
Innovations are made when conventions are broken
Fragon
Trusted Contributor

Re: can a file 's owner be chaged to another user?

What's the result of "#which chown"? Is it "/usr/bin/chown"?
Please confirm that it hasn't been replaced by another chown!

-Gerald-