tags:

views:

127

answers:

4

Have a folder and files as follows:

Folder:
drwxrwxrwx   3 me  153157   8 Aug 17 14:17 Nugget
File within Nugget:
...
-rw-rw-r--   1 web  web       24 Aug 17 14:17 nugget.php

I need to change permissions on nugget.php to 777 as per the documentation.

$ chmod 777 nugget.php
chmod: nugget.php: Operation not permitted

Suggestions?

A: 

sudo chmod 777 nugget.php ??

Daniel Elliott
as web is owner?
Daniel Elliott
+1  A: 

Your account (the one you logged in as) does not seem to have permissions on that file.

It's owned by "web", and you're not logged in as that user or that group. The permissions on that file for accounts that are not the owner or that do not belong to the web group are listed as "r--", which means the account that you logged in as can only read it.

So, login as root or "web" and perform the same operations.

James
+1  A: 

Unless you are in group web, you do not have permissions to write that file. If you own the system, you can use sudo to accomplish what you need. However, if you had sudo access, you probably wouldn't be asking.

Since you own the directory, you can delete the file. So one workaround would be: save the text of the file somewhere else (in another window). Delete the file. Recreate the file in an editor, pasting in the text. Save. That should do it. However, it's possible since this is a script that doing this would break the script (it might need to run as user 'web').

The safest alternative is to ask the system administrator to add you to the group "web", or else to have him or her change the group of the file to a group that you are in.

peterb
Thanks peterb - that worked exactly...I'm really not sure why this module is made in such a way that it requires these steps from my end.Steps:cp nugget.php nugget.tempchmod 777 nugget.tempchgrp web nugget.temprm nugget.phpmv nugget.temp nugget.php
Steve
+4  A: 

You could do this as root but I suggest to sit back and think about it for a moment. Anyone with access to your computer will be able to change this file in any way. Crackers get paid money to find files like that and abuse them.

Usually, your problem is that the web app needs to read the file and some user needs to be able to write it. In this case, chown the file to the user and leave the group as web and set the permissions to 640 (local user can read+write, web can only read).

Aaron Digulla