So, I'm logged in as sudo, and seeing this... why?


$ cd /var/www/drupal-6.19/sites/default
$ ls
default.settings.php
$ sudo -v
[sudo] password for sudo_username:
$ cp default.settings.php settings.php
cp: cannot create regular file `settings.php': Permission denied
$ chmod 666 default.settings.php
chmod: changing permissions of `default.settings.php': Operation not permitted

CONTEXT: Drupal install that requires I copy a file (default.settings.php) and rename it as (settings.php) and then change the file permissions to (666).

Believe the question is clear, but if you have any questions, just ask! - Thanks!!


UPDATE: Wow, thanks for all the quick replies, they're all correct. Selected the answer based on response time as a result. Again, thanks!!

link|improve this question

feedback

3 Answers

up vote 3 down vote accepted

You're not sudoing, you're just extending your sudo password timeout for 5 minutes. Precede the last two commands with "sudo" and it should work. If not, check the files/directories aren't immutable (lsattr file) and check getenforce.

link|improve this answer
@James Lawrie: Thanks, your answer is correct, and you beat everyone else by 1-min... So, I'm selecting you as the answer and gave you a +1 up vote too - again, thanks!! – blunders Oct 13 '10 at 20:47
feedback

Try...

sudo su

To change to root then run the commands. I'm not sure what distro you're using but -v won't change you to root I don't think.

http://www.sudo.ws/sudo/sudo.man.html

Alternatively you can run the commands with sudo before them....

sudo cp default.settings.php settings.php
sudo chmod 666 settings.php
link|improve this answer
@chunkyb2002: Thanks, your answer is correct, but 1-min behind James Lawrie, and I need to select an answer; so I'm awarding the answer based on time. Gave you a +1 up vote though - again, thanks!! – blunders Oct 13 '10 at 20:45
feedback

How are you logged in as sudo? Is this your username ? Seriously:

sudo cp default.settings.php settings.php


sudo chmod 666 default.settings.php

or use:

sudo -i
link|improve this answer
@Casual_Coder: Thanks, your answer is correct, but 1-min behind James Lawrie, and I need to select an answer; so I'm awarding the answer based on time. Gave you a +1 up vote though - again, thanks!! – blunders Oct 13 '10 at 20:45
feedback

Your Answer

 
or
required, but never shown

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