Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

linux

chmod

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

like image 977
user21 Avatar asked Mar 05 '15 20:03

user21


People also ask

What does chmod 644 mean?

Permissions of 644 mean that the owner of the file has read and write access, while the group members and other users on the system only have read access.

What does chmod 444 mean?

444 = (r-- r-- r--): owner/group/others are all only able to read the file. They cannot write to it or execute it.

What does chmod 777 mean?

Some file permission examples: 777 - all can read/write/execute (full access). 755 - owner can read/write/execute, group/others can read/execute. 644 - owner can read/write, group/others can read only.

What does chmod 755 mean?

755 means read and execute access for everyone and also write access for the owner of the file. When you perform chmod 755 filename command you allow everyone to read and execute the file, the owner is allowed to write to the file as well.


2 Answers

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.

For the sake of completeness:

  • "u" is for user / owner
  • "+" is for adding permissions
like image 94
Danny Avatar answered Sep 24 '22 19:09

Danny


You can do the following command on the file:

chmod 744 filename
like image 33
Greg M Avatar answered Sep 24 '22 19:09

Greg M