Warm tip: This article is reproduced from serverfault.com, please click

The write permission of files disappear after the files are copied between 2 remote system using FTP

发布于 2021-01-13 23:02:07

I have setup FTP between 2 remote systems and scripts are set up on both the system to Archive and Extract the file. So the script in the source Archives(tar) file and the script on the destination (extracts) the file. After each FTP transfer, I notice that files copied in the destination have write permission missing in the group(rwxr_xr_x).

I have checked manually creating the file and also the umask value of the user and when creating a file manually, it creates with write permission for the group user. This seems to be limited to only this FTP operation. Any Ideas?

Questioner
Johnny_doubts
Viewed
11
James Sneeringer 2019-01-24 01:32:25

If the file being transferred via FTP is a tar file, and the problem is that permissions of files within the tar file are not being preserved or honored after extraction, it's not an FTP problem.

When extracting the file, tar will by default honor your umask. In this case, I would guess it's set to 022, which masks the write bit for "group" and "other" in newly-created files. You need to run tar with the -p option when extracting to force it to keep the exact permissions as they appear inside the tar file.