NeilSec: Security Learning Blog

Pentesting, infosec, hacking, learning.

  • Home
  • Knowledgebase
You are here: Home / Linux / File Permissions

File Permissions

2018-01-04 by Neil Leave a Comment

r = READ (View the file/directory)
w = WRITE (Change/modify the file/directory)
x = EXECUTE (Run code/program or enter directory)

rwx = 7
rw- = 6
r-x = 5
r– = 4
— = 0

Each group of 3 permissions is in the following order:
user:group:others

Common Permissions
777 = rwxrwxrwx
770 = rwxrwx—
755 = rwxr-xr-x
700 = rwx——
666 = rw-rw-rw
644 = rw-r–r–
600 = rw——-

The numbers stand for 1 or 0 in each group of 3. E.g. 6 in binary is 110 = rw but no x.

The first character is either a hyphen or a ‘d.’ A hyphen denotes a regular file, while a ‘d’
denotes a directory.
The next three characters tell us the permissions for the user that owns the file.
The following three characters tell us the permissions for all members of the group
which owns the file.
The final three characters tell us the permissions for all others.

Example
-rwx—— 1 [User] [Group] [size] [Date-Modified] [Filename]
-rwxr–r– 1 root root 5386 Nov 15 14:49 r00ter.c

root user can rwx, root group can read, others can read only. Size=5385, date as shown, filename=r00ter.c

Changing permissions
chmod 777 filename gives rwx user, group and others
chmod +x filename gives x to user group and others

Change ownership
chown root filename changes file ownership to root
chgrp root filename changes group for file to root

Filed Under: Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

About Me

I’m currently a systems admin / consultant at a IT firm who looks after the computer systems of small businesses in the UK. IT security is only a part of that job. However I’ve always enjoyed breaking into, getting around, subverting and otherwise hacking things, systems and ideas. In tackling some low-level IT security tasks I reignited my interest in the field and this blog charts my progress in the world of Computer Security, legal Hacking, Penetration Testing, Infosec – whatever you want to call it. As a Windows guy I’m learning about Linux, shell-scripting, python and all the other skills needed in this field.

Tags

Apache Boot-to-Root CTF curl dib Dirbuster FreeBSD Hack The Box Linux mysql NFS Penetration Testing PHP RCE shell VulnHub Wordpress

Categories

© 2023 · NeilSec;