This is an archived version of the course. Please find the latest version of the course on the main webpage.

Chapter 3: Advanced Commands

Changing file permissions

face Harry Coppock

chmod allows the user (assuming that he is the owner) to change the permissions of a file. There are a number of ways to use chmod to grant and take away permissions. However, for simplicity, only one method will be detailed below.

chmod options permissions fileName

So if we wanted to allow for:

  • the user can read, write, and execute it
  • members of your group can read and execute it
  • others may only read it
chmod u=rwx,g=rx,o=r someFile

Exercise:

Create a file called mySecretFile.txt. Check its default file permissions. Using chmod, change the file permissions so that you can read, write and execute it, group members can read and execute it (write is required to delete or modify it) and anyone else outside of your group cannot even see it/know it exists.