I have a script to copy binary files to the remote machine and once the files are copied in the tmp file of the remote servers. It automatically sudo login to the host and does cd /tmp and chmod 775 to copied files but it prompts me an error operation not permitted. Then again i will have to sudo logout and go to /tmp folder then change the permission manually and again sudo login to the host and then i have to install the binaries (/tmp/copied file).

Note: The binary file is owning full permissions

Is there a way where i can change permission of the copied file in the /tmp without sudo logout.


You can use rsync with -a option, considering you have a user at remote server same as the owner of files in your case binary files.

-a option in rsync transfer files form on machine to another with all attributes .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.