Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am using Ubuntu Linux and am new to Linux. When I try to try to edit some files it requires root privileges.

Following command gives a permission error:

echo "xyz" > abc.txt

But using sudo echo "xyz" > abc.txt works

I want to do the same thing from UI. So how can I do it?

Also some files like hosts and hostname cannot be edited. Any clues on this? I guess they are read only. How can i make them writable?

share|improve this question

migrated from serverfault.com May 3 '12 at 14:12

This question came from our site for professional system and network administrators.

2  
I can guess some reasons for the downvotes, but the poster has a legitimate (if naive and/or off-topic) question. If you feel the need to downvote it, please add some constructive criticism in a comment so they can ask better questions next time. –  pjmorse May 3 '12 at 13:26
    
I don't believe it. If echo "xyz" > abc.txt fails, sudo echo "xyz" > abc.txt will also fail –  stew May 3 '12 at 13:35

2 Answers 2

The files appear as read-only because you don't have enough permissions to modify them. If you want to use the GUI, you run your editor from command prompt like:

sudo gedit
share|improve this answer

I don't think this is necessarily a serverFault topic, more like superuser...but you should be able to change permissions via chmod.

I'm assuming you're the file owner, in which case

sudo chmod u=rwx

MIGHT (emphasis on the might) work to give you permission to mess with the file outside of sudo. the u+rwx specifies that the 'user'(owner) of the file gets the r, w, and x permissions (read write execute).

I'm by no means a linux expert, but that seems like it should work. If you require more help, superuser would be the better stack exchange site to ask on, as serverfault is more for server issues.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.