chmod - protect users' file being accessed so only owner can access?

user21 picture user21 · Mar 5, 2015 · Viewed 28.7k times · Source

How to set chmod, so that ONLY owner of the file can read, write and execute? (other users cannot read, write, and execute)

Answer

Danny picture Danny · Mar 5, 2015

chmod 600 filename will do it; or chmod 700 if it is an executable.

Another way that is less cryptic is:

chmod go-rwx filename

  • The "g" is for group
  • The "o" is for others
  • The "-" is for removing permissions
  • The "r" is for read-permission
  • The "w" is for write-permission
  • The "x" is for execute permission.