0

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

voretaq7
  • 79,879
  • 17
  • 130
  • 214
  • 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

1 Answers1

1
  • 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.
Eugen Rieck
  • 186
  • 2
  • 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) –  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() –  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. –  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 07 '13 at 16:24