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?
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.
hmm... thank you for pointing out to that.. I will check on that and reply back if that solved the issue... Thank you James :)
I tried it worked but I have a newer problem at hand. The tar file happens to contain files created by different user, while this method works for files the user who is untarring owns it doesn't seem to have any effect on other user files. I'm unable to wrap my head around it. So I tried untarring the file as a 3rd user who has a umask of 0077 to my astonishment there is no change in the file permission after untar a tarred file with 777 permission after untar still retains the same set of permission (777)