Linux Permissions – What Does
One of the things I'm currently learning properly in Linux is file and directory permissions.If you run:
ls -l
you might see something like:
drwxr-xr-x
It looks complicated at first, but it's actually quite logical once you split it up.
The first character tells you what you're looking at:
d = directory
- = normal file
The remaining characters are split into three groups:
rwx r-x r-x
These represent permissions for:
Owner | Group | Others
And the letters mean:
r = read
w = write
x = execute
So:
drwxr-xr-x
means it's a directory, the owner can read, write and access it, while the group and everyone else can read and access it but can't modify it.
You may also see the same permissions written numerically as:
755
That's because:
r = 4
w = 2
x = 1
So rwx = 7 and r-x = 5, giving 755.
It's one of those bits of Linux that looks cryptic until somebody explains what each character actually represents.
I'm slowly getting there!
Do you normally use the letter permissions such as rwx, or do you think of them as numbers like 755?