chmod question

What three-digit number would you use with chmod to set the following permissions to a file -rw-------

The simple answer is 600

There is a chmod calculator here

Your example signifies, read and write, but no execute permissions for the file owner ONLY … there are no permissions for either group or everyone else.

Thanks, so rw is read write and then is it the lack of anything else or the dashes that signify the person can’t change permissions?

think of your example in 4 sections

- / — / — / —

The first - will be one of - (= file), d (= directory), or l (= symlink)

the next three are the permissions of the file owner

the next three are the permissions of the group the file belongs to

the next three are the permissions of everyone else

options are r (read), w (write), x (execute)


so in your example:-
rw- = 4+2+0 = 6
= 0+0+0 = 0
= 0+0+0 = 0

so is represented as 600


So if you look at the text under my avatar (to the left), you’ll see it ‘actually’ reads “666 … The Number Of The Beast” :wink:

ahh so because there was just rw and the -, and not an x instead of the dash it means I can’t execute permissions.
Can I also ask how do I find out which of my files has a stickybit set out of these:

-rw-r–r-- 8 1
-rwxrwxrwx 7 2
-rw-r–r-- 6 3
-rwxr-xr-t 5 4
-rw-r–r-- 4 5
-rwSr–r-- 3 6
lrwxrwxrwx 1 7

Thats not how they actually appear; I put a number instead of the linux/date/file name. I know the answers 4 but idk how to get there.

it means the file will allow ONLY it’s owner to read it, to write to it, but not to execute it (if it’s actually an executable).

so why was number 4 right then?

extended attributes are explained quite well here

Thanks alot, I managed to do the last one too. Lonk helped alot!

You’re most welcome :slight_smile: