howart
asked on
Problems copying a file with cp -p filename in Linux
On the system are 2 users which want to preserve the file modification times of a file when copying this file from a develop system to the production system. Both systems are Linux.
Both users are member of the same group.
umask for the users is 0012
When I use cp -p file /mnt/remotemachine/remoted ir/file
It gives an error :
cp: setting permissions for `/mnt/10.31.0.1/xintpro/PR OD/xlog/co pytest3.te st': Operation not permitted
Both users are member of the same group.
umask for the users is 0012
When I use cp -p file /mnt/remotemachine/remoted
It gives an error :
cp: setting permissions for `/mnt/10.31.0.1/xintpro/PR
ASKER
when the user is owner of the file on the remote system it works.
ASKER
it is a NFS share and it doesn't work!
Only the owner of a file is allowed to change permissions. This applies to local filesystems & NFS.
However I am uncertain whether non_owner can change timestamps. Instead of using -p, try --preserve=timestamps to answer that.
Another approach: if the user has write access to the directory, he can delete the file and recreate it. Then all attributes may be preserved, including owner.
However I am uncertain whether non_owner can change timestamps. Instead of using -p, try --preserve=timestamps to answer that.
Another approach: if the user has write access to the directory, he can delete the file and recreate it. Then all attributes may be preserved, including owner.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yep works.
Any ideas how i can achieve the same with Midnight Commander?
Any ideas how i can achieve the same with Midnight Commander?
Sorry, no.
if you use NFS to share the directory and copy and paste files with permissions (assuming the uid and gid are same across machines) then it should work.