0

I have a root folder with the permissions as

drwxr-xr-x

All the folders that are in the root directory has the same permissions.

drwxr-xr-x

I have a PHP script which creates a PDF file on the Server (Which is on one of the folders in the root directory) and because of the limited permissions am unable to create the pdf file in the folder.

I wanted to Change the Access permissions of the Folder and tried the below command

chmod g+w Images     (Images is a folder)

It executes and gives me nothing and when I try

ls -l   (The permissions are same and it didn't change)
drwxr-xr-x   (The write permissions are missing to generate the pdf file)

When I try

mkdir -m 775 imagetest

It Returns me with "mkdir: cannot Change permissions of 'imagetest': Permission denied"

The Imagetest Folder is created with the same permissions as

drwxr-xr-x

Can anyone help me out here. I was struck at this Point on changing the folder permissions.

From the comments, when I try

ls -ld Images 
drwxr-xr-x 1 ZUHTRF6 1049089 0 May 25 
  • Please don't chop parts out of your directory permissions. In the directory above Images, where you run chmod g+w Images, please then run the command ls -ld Images and put the result in your question. – roaima May 25 '18 at 12:02
  • I have updated my question. – John May 25 '18 at 12:09
  • You've chopped off part of the result of ls -ld again. Please stop doing that and instead put the entire result in your question. Presumably up next to your chmod g+w Images command? – roaima May 25 '18 at 12:17
  • I can't follow what you're doing in what directory. But in any case, as the owner of the new directory, you should be able to change its permissions. What filesystem are you running? Is there anything else that would be in any way special with the filesystem or directory tree? – ilkkachu May 25 '18 at 13:06
1

When changing permission of a folder already existing you should use chmod xxx yourFolder/. You can do this recursivly by adding -R.

Check with which user you are logged in using whoami and compare it with the user displayed from ls -l, to see if your current user is allowed do make a permission change.

Using chmod g+w file adds write permission for the group.

You could also do this with sudo if you are root, but watch out that you know what the commands are doing :)

  • Hello, both the users are same. The user logged in and the user from the ls -l are same. chmod g+w file is not working in my case. when I try sudo it says command not found – John May 25 '18 at 12:11
  • Even the chmod 775 filename is not changing the folder permissions – John May 25 '18 at 12:19
  • Have you checked if you are logged in with the correct user (in that case it would be ZUHTRF6 case-sensitive!). If you are already at the point where you try to call the PHP script, are you doing it from the CLI - or from the browser through a webserver which is running under a different user. Strange that sudo isn't found, what distro are you using? Like roaima said we really need you to show us the FULL error logs / outputs of commands, otherwise we could easily oversee something ;) Also take a read on chmod and how UNIX permissions are handled. No offense. – dahe May 25 '18 at 12:33
  • Am running from the browser through a webserver which is running under a different user. I use git server – John May 25 '18 at 12:48
  • @john please put these updates in your question. Not in comments. Remember you should be wanting to make it as easy as possible for people to read and understand your question! – roaima May 26 '18 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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