Unix file permissions

Grant read-only permission to user.

chmod 400 <file>

Grant read and write permissions to user.

chmod 600 <file>

Grant read, write and execute permissions to user.

chmod 700 <file>

Notice that we’re only concerned with the first number in the above examples out of the three numbers. We leave the second and third numbers as 0.

The first number relates to the user permissions, the second to the group and the third to others (anyone who is not part of user or group).

So if we wanted to change the permissions for group, we’d modify the second digit like so:

chmod 740

This would grant all permission to user and read-only permission to group.

Alternatively, we can do the following if we don’t want to touch user or other.

chmod g+r

Sajad Torkamani

Hello! My name is Sajad. I’m a software developer at Nationwide and an aspiring entrepreneur. Originally from Afghanistan, I moved to London at an early age and have been living here for the past 20 years.

This is my personal website where I blog mostly about programming with occasional thoughts on a bunch of other things. I write mainly for my own benefit as I find that writing helps clarify my otherwise very confused thoughts.

Get in touch: sajadtorkamani1@gmail.com