scp
command doesn't preserve the permissions of the file by default. So you may need to add -p
option to keep it.
% ls -l test.rb
-rwxr-xr-x 1 user staff 0 Aug 9 15:33 test.rb
% scp test.rb myhost:
test.rb 100% 0 0.0KB/s 00:00
% ssh myhost ls -l test.rb
-rw-rw-r-- 1 user user 0 Aug 9 15:33 test.rb
% scp -p test.rb myhost:
test.rb 100% 0 0.0KB/s 00:00
% ssh myhost ls -l test.rb
-rwxr-xr-x 1 user user 0 Aug 9 15:33 test.rb
Using rsync
instead is an option to consider.