0

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!!

blunders
  • 813
  • 7
  • 14
  • 30

3 Answers3

3

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.

James L
  • 6,025
  • 1
  • 22
  • 26
  • **@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
2

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
chunkyb2002
  • 688
  • 3
  • 9
  • **@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
1

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
Casual Coder
  • 1,216
  • 1
  • 11
  • 12
  • **@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