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 want users to be able to upload files to a central file server via my PHP script. I mounted the file server's shared volume using this command:

sudo mount -t cifs // local_dir -o username=user,password=pass

Whilst I could sudo chmod my way to write access, there are hundreds of directories which already exist:

drwxr-xr-x 1 root root    0 2011-03-30 15:59 dir1
drwxr-xr-x 1 root root    0 2011-04-04 16:27 dir2
drwxr-xr-x 1 root root    0 2011-04-04 18:07 dir3
drwxr-xr-x 1 root root    0 2011-04-06 13:41 dir4
drwxr-xr-x 1 root root    0 2011-04-06 13:39 dir5

I may need to create a new directory or move the uploaded file to an existing directory.

Is there anything I can do to make this share writeable by any user? The only other solution I can think of is to have Apache run as root. I won't be doing that.

share|improve this question
up vote 2 down vote accepted

sudo mount -t cifs // local_dir -o username=user,password=pass,umask=0777

share|improve this answer
Thanks Jason, your answer pointed me in the direction of the solution. You probably would have given me the correct solution if I'd mentioned that the remote share is a Windows volume. – Kalessin May 25 '11 at 17:23

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.