Skip to main content

Different File Folder Permissions When Uploading Script

Comments

7 comments

  • keat63
    Are you sending them directly from one server to the other ? I personally wouldn't know how to do this, it's something that i've never tried. I would ordinarily use my local PC as a middle man. What happens if you download to your PC then upload to the new server ?
    0
  • durangod
    Hi, thanks for your reply.... no i am downloading the zip file from cpanel to my pc, then the file gets unzipped to my pc and the folder gets put into github, then the user gets it from github. However we have also tried it with me sending the zip file directly to him and skipping github and the same thing, he uploads it to his server and 700 So far in my research i have found this, it still does not really explain it fully but its in the right direction i think... [QUOTE] most archive formats -- including zip -- do NOT include permissions in their archive. When you unpack the files they will default to whatever permissions the directory you unpack them into has. This is why most folks use tarballs as they do include permissions. .zip, .rar, and .7z do not.
    That makes sense other than the fact that his folder is 755..
    0
  • keat63
    What does he use to upload them to his server. I used to use WSFTP for instance, which if I recall would change the permissions for some unknown reason. Today I use FileZilla. So I just created a new folder on my PC. SFTP uploaded it to one of my cpanel accounts, and it went across as 755. I changed its permissions on the server to 700 and deleted it from my PC. Then downloaded back to my PC. Removed it from the server. Re-uploaded it back to the server and now its permissions was 775. Considering it was 755, then manually changed to 700, which ended up being 755 with no interaction from me other than SFTP. Something is going on that I can't explain, but proves that it's not just you. This was an empty folder by the way, no files, no zips etc.
    0
  • SamuelM
    Hello @durangod I'm not sure if I understand the exact reproduction steps for this issue. Am I correct in understanding that the directories inside a .zip archive are being assigned permissions of 700 after being unzipped? Or are the contents of the .zip archive extracted prior to being uploaded? Note that the umask is responsible for setting the permissions on newly created files, unless the new files are already assigned permissions, as in a tar archive.
    0
  • durangod
    Thanks for the replies.... turns out after some testing its not a cpanel issue. I sent two archives to the user, one tar and one zip via email, they both uploaded correctly as 755 folders. Now the only difference is that the first time the user got the files via my repo on github, so it seems that somehow github repository changes the file permissions of the files in some way. I am still researching this..... :) Has anyone ever heard of github changing file permissions?
    0
  • SamuelM
    Hello, I'm glad to hear it's not a cPanel issue. As for file permissions changing when moving files into your git repository, that may be dependent on a number of different factors, for example the environment of your local PC and the method you are using to move the files into git. The following 3rd party article provides a brief overview of how git handles file mode settings:
    0
  • durangod
    Thanks for the link im sure it should help... appreciate that very much.. I upload my repo using githubs desktop application. I cant use the cpanel github deal because it means i have to enable ssh and i dont want to do that. I feel safer using the desktop app. For those of you who are new to github, get their desktop application, it makes quick work of keeping your repo updated, add a comment, hit two buttons and done the master is updated. I tried doing the same directly in github and they made it sooo complicated i could not understand what i was suppose do to and when.. But the desktop app makes it so easy.. no logging in, it just does it.. Now i am sure that with such automation there might be some downsides (like maybe this permission deal) im not sure.... But i like it anyway... :)
    0

Please sign in to leave a comment.