Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Who can access a file with octal permissions "000" on Linux/UNIX?

Tags:

linux

shell

unix

If a file has permissions 000, who or what can access the file? What can they do to it?

What, exactly, does 000 (---------) permissions on a file mean in practice?

like image 847
jslearner Avatar asked Apr 08 '11 10:04

jslearner


People also ask

How do I get octal permissions in Linux?

You need to use the stat command to view or get octal file permissions for given filename. By default the ls command will not display the permissions on a file in octal form. The permission in octal form is useful for many commands such as chmod command and other sysadmin tasks.

What are 755 permissions?

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

root can do everything, others (with userid != 0) can't do anything. But anyone who has write access to the containing folder is allowed to delete the file. The owner can of course always change the flags and regain access anytime.

greybox:~ septi$ touch foo greybox:~ septi$ chmod 000 foo greybox:~ septi$ ls -l foo ----------  1 septi  staff  0 Apr  8 12:28 foo greybox:~ septi$ cat foo cat: foo: Permission denied greybox:~ septi$ sudo ls -l foo Password: ----------  1 septi  staff  0 Apr  8 12:28 foo greybox:~ septi$  
like image 51
tamasgal Avatar answered Oct 08 '22 06:10

tamasgal


File with 000 permission can be read / written by root.

Everybody else cannot read / write / execute the file.

like image 21
pajton Avatar answered Oct 08 '22 06:10

pajton