command cp -p in HP-UX

Hi everybody,

Im am not very familiar with HP-UX (I ususally use Solaris) and I am surprised by the command cp -p.
Under solaris when you type cp -p toto titi, the file titi keeps only the date and time of toto but not the userid : the userid of titi is yours.
Under HP-UX, with the same command the file titi keeps also the owner of toto EVEN IF THIS OWNER IS ROOT !
Can somebody tell me if this normal ? and how to do to keep only date and time of the original file ?
Thanks in advance for your response.

With reference to the HP-UX cp man page:

-p 	 	

(preserve permissions) Causes cp to preserve in the copy as many of the modification time, access time, file mode, user ID, and group ID as allowed by permissions.

I guess You have rights to set owner root? Are You member of root/wheel group or something similar?

Also, from the Solaris 10 cp man page:

Both Solaris and HP-UX attempt to preserve the owner during a "cp -p" and neither OS will complain if this does not succeed. On both OS's, root can change the owner of a file. Either OS can be configured to allow non-root users to change the owner of a file or to prohibit non-root users from being able to change the owner of a file. However, with both OS's only root can reconfigure the OS. This is mentioned in Unix File Permissions

Thanks for your answers, but this was not my question. Maybe my english is not clear enough (I'm french, sorry).
First I am not root, just a lambda user with no extended rights.
My question is that the result of the command cp -p is not the same with solaris and with HP-UX.
I try the following commands (with my lambda user) :
cd /tmp
cp -p /etc/passwd .
ls -ls passwd
on solaris, the result file passwd under tmp is owned by me, not by root (despite -p option)
on HP-UX the result file passwd under tmp is owned by root.

Thats pretty 'funny' (or not!), both OS claim to preserve owner and group ID ... but solaris does additionnal check, if you are root or the owner of the file being cp'ed then owner ID of the file is preserved!

This is the default behaviour followed by HP-UX. You can change it using setprivgrp. Here's the man page.

I discovered the same as the OP today and I have to agree with him that it's ridiculous behaviour. If a non-privileged user copies another user's files using -p I would expect it to retain modification dates, group ownership if the user was in that group, but certainly not user ownership unless setprivgrp -g CHOWN is set, which in my case, it isn't!

So I end up with a crazy situation where I can copy privileged files/dirs into my home directory (for example)... and then I can't get rid of them, modify them or anything! What a silly thing to have to bother the system admins to fix (luckily I'm one of them, but...). :confused:

ETA: I can't see how to change this behaviour using setprivgrp? Do you mean using -g CHOWN? That would increase a particular user's capability to chown files... to emulate the more sensible behaviour of other Unix we would need to reduce such a capability to prevent it from happening to copied files. Am I missing something?

Ignore my ETA... I assumed that CHOWN would not be set by default, so it actually is set on our systems. Crazy, IMO, but at least it's reversible.