Informatics1-2018/Lab04

A MathWikiből
A lap korábbi változatát látod, amilyen Gaebor (vitalap | szerkesztései) 2018. szeptember 24., 12:32-kor történt szerkesztése után volt.
(eltér) ←Régebbi változat | Aktuális változat (eltér) | Újabb változat→ (eltér)

Linux permissions

  • Permission groups
    • superuser (su), sys admins
    • owner, the user who made the file/directory, ex. someone
    • group, a subset of users with a distinct name, ex. student
    • others, everyone else, public, guest, untrusted unsers
  • Types of permissions
    • w: Write, can modify
    • r: Read, can read
    • x: eXecute, run a program, or list a directory
    • -: none

It is specified who can do what, ex:

  • owner can write, read and execute
  • its group can read and execute, but not modify
  • others cannot do anything

The superusers (su) can do anything at any time, only a superuser can make an other user super.

These can be expressed with a set of three alpha-numeric charactes:

  • u: user, owner
  • g: group
  • o: others
  • a: all of the above
  • read: r or 4
  • write: w or 2
  • execute: x or 1
  • none: - or 0

The a is not the same as o, because it is possible that a group does not have a permission, but someone outside of the groups has.

The permissions can be represented with a 10 character string:

1 2 3 4 5 6 7 8 9 10
type owner group others
read write execute read write execute read write execute
$ ls -l ~
drwxr-xr-x 8 borbely student 4096 Aug 30 23:24 Desktop
drwxr-xr-x 2 borbely student 4096 Mar 27  2012 Downloads
drwxr-xr-x 2 borbely student 4096 Oct 20  2009 Drives
drwx------ 2 borbely student 4096 Apr 20 10:42 mail
drwxr-xr-x 7 borbely student 4096 Sep  6 13:01 public_html
$ _

A public_html mappámnak a tulajdonosa: borbely, csoportja student, azonosító: drwxr-xr-x, vagyis:

  • típusa d: könyvtár
  • saját jogaim rwx, vagyis minden (hál' Istennek)
  • diáktársaim jogai r-x, vagyis írni nem írhatják, de minden mást szabad
  • mindenki másnak r-x, vagyis más is olvashatja és futtathatja

Numerikusan egy 3 számból álló érték határozza meg a jogokat. Balról az első szám az owner jogok, aztán group majd others. A számok 4: olvasás, 2: írás, 1: execute. Ezek összeadódhatnak. Pl /home/student/borbely/public_html jogai: 755 azaz

  • owner (borbely) 7=4+2+1: írás, olvasás és futtatás
  • group (student) 5=4+1: olvasás és futtatás
  • other 5=4+1: olvasás és futtatás

chmod

A jogokat a chmod paranccsal változtathatjuk meg. Néhány példa:

  • chmod 700 ~/info_hazi: elrejtem az info_hazi mappámat rajtam kívül mindenki elől (nem tudnak belelépni, sem listázni a tartalmát), persze a superuser-ek láthatják.
  • chmod 750 ~/important_work: ebben a mappában egy group-al együtt dolgozok valamin, a group olvashatja és futtathatja, én írhatom is, senki más nem láthatja.
  • chmod 754 -R ~/public_html: az -R kapcsoló rekurzívan alkalmazza a beállításokat a mappa tartalmára.

Bővebben

Személyes eszközök