Thursday, November 22, 2018

upload - Windows file uploaded to ubuntu server automatically assumes 777 permissions



Do you know how can I set permissions beforehand for a folder that I want to upload on a linux server? I'm working on a piece of software (php/mysql) on my local windows machine, I then tar the folder and upload it to my ubuntu web server. When I untar the contents, all the files and folders have automatically 777 permissions. Can I change that some way?


Answer



Since Windows does not have Unix-style permissions, tar-ing up files on Windows will not result in usable Unix permissions when it is unpacked on a Unix system.



When creating, use --mode to set a specific mode.
When unpacking, use --no-same-permissions to ignore the stored permissions and use the current users' umask.




man tar :)


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...