In terminal, I do this:

sudo vi /etc/profile

But I get a read-only version. I've never not been able to edit anything as a super user- What's going on?

link|improve this question

67% accept rate
What does ls -l /etc/profile say? -r--r--r--? – Mikel Feb 28 '11 at 4:14
feedback

migrated from stackoverflow.com Feb 28 '11 at 4:53

This question came from our site for professional and enthusiast programmers.

3 Answers

Running ls -l on /etc/profile reveals that not even the owner has write permission:

$ ls -la /etc/profile 
-r--r--r--  1 root  wheel  189 May  4  2009 /etc/profile

You can let the owner edit it like this:

sudo chmod u+w /etc/profile

Then you should be able to edit it as root.

link|improve this answer
feedback

/etc/profile is readonly.

You can make it writable with

$ sudo chmod +w /etc/profile

or better yet in vi, overwrite a readonly file with Esc-wq!

link|improve this answer
feedback

Maybe this is not what you are after, but if you can create a .profile file in your home directory and put your user-specific configuration changes in there and then you don't need to worry about the one in /etc/profile. However, perhaps you are looking to change the configuration for all users and not just a single user. If so, then the above two answers are on target.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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