From cdbe8741142a8a797a0769a86ca760245591b2b9 Mon Sep 17 00:00:00 2001 From: Laurent Modolo <laurent@modolo.fr> Date: Mon, 12 Oct 2020 14:01:36 +0200 Subject: [PATCH] add summary of cmd used --- 3_first_steps_in_a_terminal.md | 7 ++++++ 4_unix_file_system.md | 7 ++++++ 5_users_and_rights.md | 42 ++++++++++++++++++++++++++++++---- html/img | 1 + 4 files changed, 52 insertions(+), 5 deletions(-) create mode 120000 html/img diff --git a/3_first_steps_in_a_terminal.md b/3_first_steps_in_a_terminal.md index 9c0e611..17454fb 100644 --- a/3_first_steps_in_a_terminal.md +++ b/3_first_steps_in_a_terminal.md @@ -161,4 +161,11 @@ What append ? You can use the `-l` option in combination with the `-a` option to know more about those folders. +> We have seen the commands : +> +> - `cal` for calendar +> - `cd` for change directory +> - `ls` for list directory +> - `pwd` for print working directory + [You can now go to the Unix file system.](http://perso.ens-lyon.fr/laurent.modolo/unix/4_unix_file_system.html) \ No newline at end of file diff --git a/4_unix_file_system.md b/4_unix_file_system.md index 9df282f..3b781e2 100644 --- a/4_unix_file_system.md +++ b/4_unix_file_system.md @@ -222,4 +222,11 @@ mount Find which disk is mounted at the root of the file tree. +> We have seen the commands: +> +> - `stat` to display information on a file +> - `less` to visualise the content of a file +> - `ln` to create link +> - `mount` to list mount points + [That’s all for the Unix file system, we will come back to it from time to time but for now you can head to the next section.](http://perso.ens-lyon.fr/laurent.modolo/unix/5_users_and_rights.html) \ No newline at end of file diff --git a/5_users_and_rights.md b/5_users_and_rights.md index 442b4bc..f728c4a 100644 --- a/5_users_and_rights.md +++ b/5_users_and_rights.md @@ -14,7 +14,7 @@ GNU/Linux and other Unix-like OS are multiuser, this means that they are designe There is always at least one user: the **root** user - It’s the super user -- he has every right (we can say that he ignores the right system) +- he has every right (we can say that he ignores the rights system) - this account should only be used to administer the system. There can also be other users who @@ -80,6 +80,24 @@ chmod u-x,g-w,o= .bashrc What can you conclude on the symbols `+` , `=`, `-` and `,` with the `chmod` command ? +> ### Numeric notation +> +> Another method for representing Unix permissions is an [octal](https://en.wikipedia.org/wiki/Octal) (base-8) notation as shown by `stat -c %a`. +> +> | Symbolic notation | Numeric notation | English | +> | ------------------ | ----------------- | ------------------------------------------------------------ | +> | `----------` | 0000 | no permissions | +> | `-rwx------` | 0700 | **read, write, & execute only for owner** | +> | `-rwxrwx---` | 0770 | read, write, & execute for owner and group | +> | `-rwxrwxrwx` | 0777 | read, write, & execute for owner, group and others | +> | `---x--x--x` | 0111 | execute | +> | `--w--w--w-` | 0222 | write | +> | `--wx-wx-wx` | 0333 | write & execute | +> | `-r--r--r--` | 0444 | read | +> | `-r-xr-xr-x` | 0555 | read & execute | +> | `-rw-rw-rw-` | 0666 | read & write | +> | `-rwxr-----` | 0740 | owner can read, write, & execute; group can only read; others have no permissions | + The default group of your user is the first in the list of the groups you belong to. You can use the command `groups` to display this list. What is your default group ? When you create an empty file, system default rights and your default groups are used. You can use the command `touch` to create a file. @@ -140,7 +158,7 @@ The command `cp` allows you to **c**o**p**y file from one destination to another man cp ``` -Copy the `mkdir` tool to your home directory. Can you remove execution rights for the others on your copy of `mkdir` ? +Copy the `mkdir` tool to your home directory. Can you remove execution rights for the others on your copy of `mkdir` ? Can you read the contentof the `mkdir` file ? You cannot change the owner of a file, but you can always allow another user to copy it and change the rights on its copy. @@ -239,8 +257,22 @@ Check the results. ## Security-Enhanced Linux -While what you have seen in this section hold true for every Unix system, additional rules can be applied to control the rights in Linux. This is what is called [SE Linux](https://en.wikipedia.org/wiki/Security-Enhanced_Linux) (**s**ecurity-**e**nhanced **Linux**) - -When SE Linux is enabled on a system, every **process** can be assigned a set of right. This is how, on Android for example, some programs can access your GPS while other cannot, etc. In this case it's not the user rights that prevail, but the **process** launched by the user. +While what you have seen in this section hold true for every Unix system, additionnal rules can be applied to control the rights in Linux. This is what is called [SE Linux](https://en.wikipedia.org/wiki/Security-Enhanced_Linux) (**s**ecurity-**e**nhanced **Linux**) + +When SE Linux is enabled on a system, every **processes** can be assigned a set of right. This is how, on Android for example, some programs can access your GPS while other cannot etc. In this case it's not the user rights that prevail, but the **process** launched by the user. + +> We have seen the commands: +> +> - `chmod` to change rights +> - `touch` to create an empty file +> - `mkdir` to create a directory +> - `chgrp` to change associated group +> - `chown` to change owner +> - `man` to display the manual +> - `cp` to copy files +> - `sudo` to borrow **root** rights +> - `groupadd` to create groups +> - `groups` to list groups +> - `usermod`to manipulate user's to groups [To understand more about processes you can head to the next section.](https://http://perso.ens-lyon.fr/laurent.modolo/unix/6_unix_processes.html) \ No newline at end of file diff --git a/html/img b/html/img new file mode 120000 index 0000000..6ffc6ca --- /dev/null +++ b/html/img @@ -0,0 +1 @@ +../img \ No newline at end of file -- GitLab