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

i have ubuntu 10.04 on my server. when i was create a file by ftp, php and ... files permission is 600 and folders is 700. how can i change default files permission into 644 and folders to 755?
upload file by CuteFtp
my username is not ROOT
suphp installed

share|improve this question

migrated from Feb 27 '12 at 2:50

This question came from our site for professional and enthusiast programmers.

Your FTP server should have a configuration file (or, failing that, a startup script) where you can set its umask. – tripleee Feb 26 '12 at 17:40
  • The FTP part depends, on which FTP server you use. E.g. on vsftp you need to edit anon_umask
  • The HTTP part is most portably solved by using chmod() after creating the file.
share|improve this answer
i was change it to 022 but permission 700 and 600. when i change it to 0022 permission changed to 755 and 644. but files and folder witch create by php are 700 and 600 again. how can i change it? (widthout chmod and other commands) – Hamid Tanhaei Feb 26 '12 at 18:36
I meant chmod() as PHP function! You don't need to run it on the server command line, but from your PHP code (I gave the link in my answer). You use fopen() ... fwrite() ... fclose() ... chmod() – Eugen Rieck Feb 26 '12 at 18:46
i said command but i maen chmod() and the same commands i want this configurations done in the server. – Hamid Tanhaei Feb 26 '12 at 19:43
You need to set the umask of the thing creating the files (if you're talking about PHP scripts, that means your web server. If your web server is Apache, you can change the umask of the parent process by setting it in the startup script. There is also a umask() function in PHP that you can call in individual scripts. – voretaq7 Mar 7 '13 at 16:24

Your Answer


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