Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from Feb 28 '11 at 4:53

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

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

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

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .