I have 2 users on a remote machine (let's call them user1
and user2
, with both being in the common group upload
).
I want to be able to upload/override a file via scp
, from different machines. Whereas machine1 uploads with user1, and machine2 uploads with user2.
machine1: scp -p myfile.txt user1@<ip>:/opt/test/
machine2: scp -p myfile.txt user2@<ip>:/opt/test/
Problem for user2: set mode: Operation not permitted
. This seems to be caused by the -p
flag (preserve timestamps). As when I remove the parameter, everything works fine.
Question: how can I still preserve timestamp if I'm not the owner of the remote file that should be overridden?