Version 2 (modified by Jamie McClelland, 12 years ago) (diff)


How do I know if a file is world readable? How can I change that?

On a typicaly linux system, there are three sets of permissions:

  • user: the permissions for the person who owns the file
  • group: the permissions for users who are in the group assigned to the file
  • other: the permissions for everyone else who has an account on the server

Each set of permission can have three values:

  • write access
  • read access
  • execute access

The first two are self-explanatory. The third (execute access) has two different meanings:

  • For a directory, it means that you can enter the directory and get details of the files in the directory
  • For a file, it means you can execute the file (required if the file is a program)

If you are using an SFTP program to access your directories, the method for will vary depending on the program you are using. If you are using WinSCP, simply right click on the file or folder and click properties. You will see the current permissions and be given an opportunity to change them.

If you are using secure shell you can change the mode of a file or directory with the chmod command. In the following examples, the change in mode is being applied to the directory called foo.

# remove read access from others
chmod o-r foo

# remove read access from the group
chmod g-r foo

# remove read and execute from all users execpt the owner
chmod o-rx foo
chmod g-rx foo

# Add read and execute access for everyone
chmod o+rx foo