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 changed the permissions of my host file /etc/hosts by doing a chmod og+w.

What's the default permission so that I can switch it back?

share|improve this question
    
Is it 444? Read all? –  Ashfame Jun 27 '11 at 20:41
    
The reverse of that command is sudo chmod og-w /etc/hosts. Most files have permissions like 644 and directories 755. Exceptions exists, highly sensitive files like /etc/shadow have 640. –  Lekensteyn Jun 27 '11 at 20:55
    
Thanks but I don't think the reverse applies for every command, may be just here but not in all situations and that's why I asked to be sure :) –  Ashfame Jun 27 '11 at 20:57
    
The sudo chmod o-w whatever can almost always be executed without pain. Only shared directories like /tmp or /var/tmp have that permission bit set, having it in other directories might introduce a security hole. –  Lekensteyn Jun 27 '11 at 21:00
    
Good point! I wasn't sure of the group part, may be it had the permission for the group and may be not. –  Ashfame Jun 27 '11 at 21:04
add comment

1 Answer

up vote 5 down vote accepted

The default file permissions for /etc/hosts is 644. (readable and writable for the owner, root, and readable for others.)

share|improve this answer
    
Just curious, why it needs to be executable for the owner? –  Ashfame Jun 27 '11 at 20:53
3  
It's not. 4 (read) + 2 (write) = 6. Read more on file permissions. –  htorque Jun 27 '11 at 20:54
    
oh sry, yes that makes sense. –  Ashfame Jun 27 '11 at 20:55
add comment

Your Answer

 
discard

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

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