Linux Permissions – What Does

Unison

Well-known member
VIP

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?
 
rwx

But you should be limiting commands to sudo permissions. I'd imagine you're using root, which isn't best practice for security reasons. Better to put users into the sudo folder, and do stuff like;

Sudo su

Other helpful commands that I know and use;

ls -l = List
ls -lhr = list human readable
cd = change directory
mount -o = Mount a filesystem
rm = remove a file
mkdir = make directory

And of course you can always use the man pages. Think it's man in any directory using a command and you can see the variables of the command
 
rwx

But you should be limiting commands to sudo permissions. I'd imagine you're using root, which isn't best practice for security reasons. Better to put users into the sudo folder, and do stuff like;

Sudo su

Other helpful commands that I know and use;

ls -l = List
ls -lhr = list human readable
cd = change directory
mount -o = Mount a filesystem
rm = remove a file
mkdir = make directory

And of course you can always use the man pages. Think it's man in any directory using a command and you can see the variables of the command
Thanks, some useful commands there. 👍

I'm still learning Linux properly at the moment, so I'm trying to get into the habit of using sudo only when a command actually needs elevated permissions rather than working as root.

I've just started getting comfortable with ls, cd, mkdir, rm, mount and permissions, so man is definitely another one I'll start using more. Every day is a school day with Linux. 🙂
 
Get yourself a cheat sheet;

Code:
https://phoenixnap.com/kb/linux-commands-cheat-sheet

I forgot the cat command too, it allows you to see whats in a folder/file system.

So like;

cat /var/logs
tail 500 - shows the last 500 entries of something
pwd - shows what directory you're in
df -h - shows the space on the drive/directory you're in
df -hr - Same as above but makes it human readable

My linux skills are super limited, I only know linux commands as I use the servers in work, and sometimes need to navigate around them, so just picked stuff up as I go. I don't use linux, it's too complicated for me :)
 
Get yourself a cheat sheet;

Code:
https://phoenixnap.com/kb/linux-commands-cheat-sheet

I forgot the cat command too, it allows you to see whats in a folder/file system.

So like;

cat /var/logs
tail 500 - shows the last 500 entries of something
pwd - shows what directory you're in
df -h - shows the space on the drive/directory you're in
df -hr - Same as above but makes it human readable

My linux skills are super limited, I only know linux commands as I use the servers in work, and sometimes need to navigate around them, so just picked stuff up as I go. I don't use linux, it's too complicated for me :)
Thanks mate, that cheat sheet will definitely come in handy. 👍

I'm starting to recognise a few of those commands now from what I've been doing, but there's no chance I'll remember them all straight away! 😄

I'm finding the best way for me is actually using the commands and understanding what they do rather than just trying to memorise them.

Cheers for the link, I've bookmarked it. 👍
 
Try and get used to using a text editor too. There's a few, VI is the most used that I know of, but it's more difficult to use imo, I always preferred nano, but again you can get cheat sheets for VI and stuff too.
 
Try and get used to using a text editor too. There's a few, VI is the most used that I know of, but it's more difficult to use imo, I always preferred nano, but again you can get cheat sheets for VI and stuff too.
Yeah, I've been using nano quite a bit on the Pi so I'm getting the hang of that now. 👍

I'll have a go with VI at some point as well, but one thing at a time. 😄
 
Back
Top