Author Topic: chmod question  (Read 309 times)

0 Members and 1 Guest are viewing this topic.

Offline kwizzymi

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
chmod question
« on: November 22, 2018, 02:48:50 pm »
What three-digit number would you use with chmod to set the following permissions to a file -rw-------

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 18002
  • Karma: 465
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: chmod question
« Reply #1 on: November 22, 2018, 03:04:54 pm »
The simple answer is 600

There is a chmod calculator here
https://chmod-calculator.com/

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.
« Last Edit: November 22, 2018, 03:07:20 pm by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline kwizzymi

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: chmod question
« Reply #2 on: November 22, 2018, 03:18:01 pm »
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?

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 18002
  • Karma: 465
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: chmod question
« Reply #3 on: November 22, 2018, 03:19:13 pm »
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)

r=4
w=2
x=1

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

so is represented as 600

[EDIT]

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" ;)
« Last Edit: November 22, 2018, 03:26:56 pm by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline kwizzymi

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: chmod question
« Reply #4 on: November 22, 2018, 03:28:45 pm »
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.


Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 18002
  • Karma: 465
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: chmod question
« Reply #5 on: November 22, 2018, 03:33:33 pm »
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).
« Last Edit: November 22, 2018, 03:41:19 pm by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline kwizzymi

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: chmod question
« Reply #6 on: November 22, 2018, 03:35:45 pm »
so why was number 4 right then?

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 18002
  • Karma: 465
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: chmod question
« Reply #7 on: November 22, 2018, 03:41:30 pm »
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline kwizzymi

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: chmod question
« Reply #8 on: November 22, 2018, 03:46:03 pm »
Thanks alot, I managed to do the last one too. Lonk helped alot!

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 18002
  • Karma: 465
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: chmod question
« Reply #9 on: November 22, 2018, 04:21:45 pm »
You're most welcome :)
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal