Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

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 :)

share|improve this answer
Thanks adaptr. Does --mode enforces the permissions for every file? --no-same-permissions worked fine for the time being (files were unpacked as 755). – Ion Dec 21 '11 at 19:30

You can try a --no-same-permissions parameter, when you untaring the contents of archive.

share|improve this answer
Yeah, I didn't read the question properly the first time either ;) He's not talking about samba anywhere - he's talking about tar(1). – adaptr Dec 21 '11 at 9:06
Yes, it was a my fault, I did't read a question carefully... I've gave you a vote. – Jan Marek Dec 21 '11 at 9:08
well thank you :) – adaptr Dec 21 '11 at 9:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.