Prakash
Prakash

Reputation: 45

change file permission while transferring from local to server

I have a file with 700 permission in my local. I need to move this file to abc directory in a server using scp command. Here, file permission should be 755 but I am getting file with 700 permission only. How can I set permission to 755 for all file moving to this directory as default.

Upvotes: 0

Views: 6118

Answers (1)

sdocio
sdocio

Reputation: 142

You could use rsync for the transfer:

rsync --chmod=u+rwx,g+rwx,o+rx file.txt user@host:abc/

If you prefer to use scp, you could set permissions after the transfer:

scp file.txt user@host:abc/
ssh user@host 'chmod 755 abc/file.txt'

Upvotes: 4

Related Questions