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?
The default file permissions for /etc/hosts
is 644. (readable and writable for the owner, root, and readable for others.)
sudo chmod og-w /etc/hosts
. Most files have permissions like644
and directories755
. Exceptions exists, highly sensitive files like/etc/shadow
have640
.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.