Les permissions sur fichiers et répertoires - #Linux 1.7
Summary
TLDRDans cette vidéo dédiée aux débutants sur Linux, l'accent est mis sur la gestion des permissions des fichiers et des répertoires. L'auteur explique comment visualiser et modifier les droits d'accès via les commandes Linux, comme `ls`, `stat` et `getfacl`. Il aborde les modes de lecture, écriture, et exécution pour les utilisateurs, groupes, et autres. Le tutoriel inclut également une introduction aux permissions en mode octal ainsi qu'à la commande `chmod` pour changer les permissions et `chown` pour modifier les propriétaires de fichiers. L'objectif est de rendre ces concepts accessibles aux novices.
Takeaways
- 📁 L'objectif de la vidéo est de couvrir les permissions de fichiers et répertoires pour débutants sous Linux.
- 🔐 Les permissions sont divisées en trois blocs : utilisateur (propriétaire), groupe, et autres utilisateurs.
- 👀 On peut visualiser les permissions via la commande 'ls -l', où chaque fichier ou répertoire affiche un triplet de caractères représentant les permissions de lecture (r), écriture (w), et exécution (x).
- 🔄 Les permissions peuvent être modifiées avec la commande 'chmod', qui permet d'attribuer des droits en mode humain ou octal.
- 🔢 Le mode octal simplifie la gestion des permissions en attribuant des valeurs numériques : 4 pour lecture, 2 pour écriture, et 1 pour exécution, ce qui permet de combiner les droits.
- 👤 Les informations sur les utilisateurs et les groupes d'un fichier peuvent être obtenues via 'stat' et modifiées avec 'chown' pour changer le propriétaire ou le groupe.
- 🔁 Le mode récursif avec 'chmod -R' permet de changer les permissions pour un répertoire et tout son contenu.
- 📜 La commande 'chmod' peut également être utilisée pour ajouter (+) ou retirer (-) des permissions spécifiques pour l'utilisateur, le groupe, ou les autres utilisateurs.
- 📝 Les fichiers et répertoires ont par défaut des permissions que l'on peut modifier pour rendre un fichier exécutable, lisible ou inscriptible.
- 👥 Les groupes permettent de gérer des permissions partagées entre plusieurs utilisateurs, et 'chgrp' permet de changer le groupe associé à un fichier ou un répertoire.
Q & A
Qu'est-ce que l'objectif principal de cette vidéo?
-L'objectif principal de cette vidéo est d'expliquer les permissions de fichiers et de répertoires sous Linux pour les débutants.
Quels sont les trois types de permissions de fichiers mentionnés?
-Les trois types de permissions de fichiers mentionnés sont la lecture (r), l'écriture (w), et l'exécution (x).
Comment peut-on lister les permissions d'un fichier ou d'un répertoire?
-On peut lister les permissions d'un fichier ou d'un répertoire en utilisant les commandes `ls -l`, `stat`, ou `getfacl`.
Comment interpréter le premier caractère des permissions listées par `ls -l`?
-Le premier caractère des permissions listées par `ls -l` indique le type de fichier : un tiret (-) pour un fichier normal, un 'd' pour un répertoire, ou d'autres lettres pour des types de fichiers spéciaux (par exemple, 'l' pour un lien symbolique).
Que signifient les trois groupes de trois caractères dans les permissions (ex : `rwxr-xr--`)?
-Les trois groupes de trois caractères indiquent les permissions pour le propriétaire (le premier groupe), le groupe (le deuxième groupe), et les autres utilisateurs (le troisième groupe).
Qu'est-ce que le mode octal et comment est-il utilisé pour définir les permissions?
-Le mode octal est une représentation numérique des permissions où les valeurs 4, 2, et 1 représentent respectivement les permissions de lecture (r), d'écriture (w), et d'exécution (x). Ces valeurs sont additionnées pour chaque catégorie d'utilisateurs.
Comment changer les permissions d'un fichier en mode octal?
-Pour changer les permissions d'un fichier en mode octal, on utilise la commande `chmod` suivie du code octal correspondant aux permissions souhaitées. Par exemple, `chmod 777 toto` rendrait un fichier entièrement accessible en lecture, écriture, et exécution à tous les utilisateurs.
Comment utiliser `chmod` pour ajouter ou retirer une permission spécifique à un utilisateur ou à un groupe?
-Pour ajouter ou retirer une permission spécifique, on peut utiliser la syntaxe `chmod` suivie de l'opérateur (+ ou -) et de la permission à ajouter ou retirer (r, w, x), ainsi que de la catégorie d'utilisateur (u pour propriétaire, g pour groupe, o pour autres). Par exemple, `chmod o-w toto` retire l'écriture pour les autres utilisateurs.
Qu'est-ce que la commande `chown` et comment l'utiliser?
-La commande `chown` permet de changer le propriétaire et/ou le groupe d'un fichier. Par exemple, `chown oki:sudo toto` change le propriétaire de `toto` à l'utilisateur `oki` et son groupe à `sudo`.
Pourquoi la commande `chmod` peut-elle être utilisée avec l'option `-R` (récursif)?
-L'option `-R` de `chmod` permet d'appliquer les modifications de permissions de manière récursive, c'est-à-dire à tous les fichiers et sous-répertoires d'un répertoire donné.
Outlines
📂 Introduction aux permissions de fichiers sous Linux
L'orateur accueille les spectateurs à cette septième vidéo consacrée aux permissions de fichiers sous Linux pour débutants. Il explique que la vidéo couvre les bases, notamment la gestion des permissions de fichiers et de répertoires, avec des explications simples pour une meilleure compréhension. Il évoque également les commandes utilisées pour lister les permissions des fichiers, telles que `ls` et `stat`, et mentionne les concepts de modes (permissions) pour les fichiers et répertoires.
🖥️ Types de fichiers et leur représentation dans Linux
Ce paragraphe explique les différents types de fichiers que l'on peut rencontrer sous Linux, comme les fichiers simples, les répertoires, les périphériques de caractères, les liens symboliques et les sockets. Il détaille l'affichage de ces types dans les résultats de la commande `ls`, en se concentrant sur la première lettre de chaque ligne, qui indique le type de fichier. L'orateur mentionne aussi les liens symboliques et d'autres types de fichiers moins courants comme les pipes (p), les blocs de périphériques (b) et les portes (D).
🔐 Bloc de permissions et lecture des droits
L'orateur détaille le bloc de permissions constitué de trois séries de trois caractères, chacune représentant les permissions pour l'utilisateur, le groupe et les autres. Il explique ce que signifient les lettres `r` (lecture), `w` (écriture) et `x` (exécution), et comment elles s'appliquent aux fichiers et aux répertoires. Les permissions sont ensuite converties en mode octal, où `r`, `w` et `x` correspondent respectivement à 4, 2 et 1. Cette section approfondit la façon dont ces valeurs sont combinées pour créer des permissions spécifiques pour chaque type d'utilisateur.
🧮 Mode octal et gestion des permissions par chiffres
Ce paragraphe aborde la conversion des permissions en mode octal et comment utiliser des chiffres pour représenter les droits des utilisateurs, groupes et autres. L'orateur explique que chaque combinaison de permissions est représentée par un chiffre, ce qui permet de définir les droits d'accès à un fichier ou un répertoire de manière concise. Il décrit comment des valeurs comme 664 ou 775 se traduisent en permissions pratiques et donne des exemples de commandes `chmod` pour modifier ces droits.
🔄 Commande 'chmod' et modification des permissions
Cette section présente en détail l'utilisation de la commande `chmod` pour changer les permissions des fichiers et répertoires, que ce soit en mode octal ou en mode humain. L'orateur montre comment utiliser les options `+` et `-` pour ajouter ou retirer des permissions spécifiques, comme `+r` pour ajouter la lecture, ou `-w` pour retirer l'écriture. Il explique également l'option récursive `-R` pour appliquer des changements à un ensemble de fichiers ou à une arborescence complète.
Mindmap
Keywords
💡Permissions
💡Fichier
💡Répertoire
💡chmod
💡Valeur octale
💡rw-r--r--
💡Propriétaire
💡Groupe
💡Lecture (r)
💡Exécution (x)
Highlights
Bienvenue à la septième vidéo dédiée à Linux, aujourd'hui nous nous concentrerons sur les permissions de fichiers pour les débutants.
Présentation des trois modes principaux pour les permissions de fichiers et de répertoires : lecture, écriture, et exécution.
Introduction à l'affichage des permissions via la commande ls et explication des différentes colonnes affichées.
Discussion sur les modes de permissions en octal et en format lisible par l'humain.
Définition des niveaux de permissions : utilisateur, groupe, et autres utilisateurs.
Explication sur les symboles des permissions : r pour lecture, w pour écriture, et x pour exécution.
Illustration des permissions avec la commande stat et discussion sur l'identifiant utilisateur (UID) et l'identifiant de groupe (GID).
Différents types de fichiers et de répertoires avec des caractères spéciaux : d pour répertoire, - pour fichier, l pour lien symbolique, etc.
Utilisation de chmod pour changer les permissions, avec un exemple sur l'ajout et la suppression des droits d'exécution.
Explication sur les permissions par défaut en fonction du type de fichier ou de répertoire et la méthode pour les définir.
Présentation des permissions en mode octal et leur correspondance avec les combinaisons rwx.
Utilisation du mode récursif de chmod pour appliquer des permissions sur un répertoire et tous ses sous-répertoires.
Présentation de chown pour changer le propriétaire d'un fichier et de chgrp pour changer le groupe associé.
Distinction entre les utilisateurs et les groupes, ainsi que l'importance de l'utilisation de sudo pour l'élévation des privilèges.
Conclusion de la vidéo et encouragement à partager, s'abonner et commenter.
Transcripts
[Music] Hey hello everyone I hope
you are well welcome to this seventh video dedicated to linux and we have
not finished discovering it today we are going to focus on permissions
file permissions for beginners so I insist because
behind there will possibly be small additions that
will be made later but we're really going to see the basics of things
I hope you enjoy this video don't hesitate to click on subscribe
to not don't miss the next videos click on join if they
wanted to support the channel talk about it around you that's what makes me
happy you're discovering it more and more so we're going to get into
file permissions and directories for beginners so already we
are on a perimeter the permissions can also be used in
other cases we will already focus on the perimeter of files
and directories and we will also manage them in a simple way then sthat we
haven't yet reviewed the elevations of privileges etc so we're really
going to say segmenting things to really manage
this in a slightly simpler way so how to list the permissions on
files and directories so this what i'm going to do here i'm still
in the directory we had in the previous video in the right terminal
i'm going to make a heap off of a file called totals if i do
an lsg of my toto file which is displays see here
I do then I do the equivalent dclear but with a check it that
's why I go back each time so we have three slightly
standard modes there are still a few small modes to discover
file permissions and its permissions we also call it
modes so if you use tools of a sentence all know very often
rather than putting permission we will see point mode and you have specified
something there in this case then we will create a also a small directory
we will do like this will be enough and leave I have a directory is a file
if I do it is unreal in list mode that we have already seen it previously
I do not need to do the top down it also allows you to display the
hidden officer hidden files and starting with a having the name
displayed by the hidden directories starting with a dot there in
this case we will focus on this block this is on this block this is what
we're going to find we're going to find so we're going where m this element there for the moment
we're going to find here so the permission block we're also going to find the
owner of the file and we're going to find the taste the group that's going to be
considered for the file we will we will discover its right after so that it
is fired it allows to see the permissions if I do an adventure stats
my file toto the stats also to allow to display the permissions
so there you just have to have an eye a little more informed we will find it er at
the 6.6 access level then we will see we will suddenly have the permissions in
two ways either in the way that we have seen here which is the simple mode we
will say human reading or in octal mode the month of october what is it is
a digital format as we were talking just after fairly simple to
understand but you have to have a little bit in mind we will
also find sent here the uid and the jeridi the uid so it's for the user heidi in
this case the honor so here it's me these waters who is behind it it's
him to lydie so the identifier in numerical form demont users who
owns this file we have the same thing for the group we talked about it
just a little bit later with the identifier of the group and the name of the
group in question behind we find dates so access to modification
and change here and then no doubt other information but will
still agree we will come back to it in particular the i'm not knew interesting things
and c etera but we'll see that later the other command so the speaker
tabulation is watching tabulation and there I have different options that are offered for a
month I'm going to be on the lookout I'm going to tabut the f&a
clc if I do a check it to show go up at the top and I will
always use non-files foo I do a get f to that of my file
foo and there I will find this time again in a more readable way
perhaps even for a beginner all the elements so you have this
confirms to us that our file is self that our honor of fact of this
file therefore owner of this seo file which the group since
my users have a group which has the same name the group
also its waters which is especially the permissions concerning three blocks of
permissions 3 3 levels of permission the user therefore the honor in
this case here namely therefore here permissions rw nothing at all the group r
w nothing at all and the other users those who are not
understood ic I look drawn drawn that's something that's important so we
have three commands from ls the stats and the watch the face is her
now what do we do if we redo our ls here that's it is what
we see here when we are when we have done our hells first thing the
first character here will be mentioned either one of for directory are drawn
for a simple file what we find here we have a simple file so we have
well attracted and a directory we have a d behind there are other
meanings the it is for example for the characters device for example
if I make invest and l2 flash dave we have already spoken about it the edf for device it is
l all the peripherals will be for example disks and so on and
well behind zoom out a little bit we will find so this famous it is in
the first characters watch over there everywhere here so normal
other element for example then that we will see that later the notion of
symbolic link here we will be able to represent a file ier in different
places without copying it what we call symbolic links and
there so we would have her for example we have the pai pelras a little bit rarer
still it is the p we have there the socks so crs the device blocks it's a b and
the doors it's a big capital d and so we find it drawn from the five so
the delay is running up to here it's already pretty good
so how does it work what we see here at the screen when we do when we
do our famous hells d'unréal with our file our directory so
now we are going to be interested in the block in the series of blocks of three characters which
follows here so we have three characters three characters three characters c' do
we find and when we made the gat erased they also made them
win face and l of toto we find the first block of three characters with r
w draw rw draw two groups and r draw draw then so if we take here we have
what we have just seen with the watch fcl so been postponed if we behind
what does rwx mean it's quite easy to remember for reed w for wright
and x for executables so earth for rita allow to read the file
quite simply so there angot here we will find the first block for
users the second block for users who are members of a group but
not being honor then first group - pardon group for
honor users pardon second block here for members of the group in this case of
the oki group here who are not honors that is to say that they are not
oki
then we have the last block here that is to say when I am not honored nor
in the group that is there here are the permissions that apply that is to say
r pull therefore pull era for reading so we will be able to simply read the
file w so that means that we will be able to just write in it x we will be
able to just execute it so you can imagine that we will need to
combine all things see sometimes we will have need all three, that is
to say rw and x it is for oneself why here we have a sort of triptych
each time we have a triptych each time there in this case so we
aerate w100 the x so it is not executable as such by me even
if I want to change it we will see it right after we will be able to do an
operation there in this case so we are not in
octal mode as I told you c that is to say we are in easy-to-read human mode
etc. if we want to switch to octal mode it is a little more a little
more complicated, that is to say that rather than having
nine elements to define the characteristics of a file or a
directory in terms of mode permission we will see we will only have three
but to have only three you see that we need to manage the
rw and the x each time so we can define do we allow reading, writing
and executing to manage this there is a very simple system see that here on
the left is based on the darid equivalence for u do value of 4 a wright for
a value of 2 and a executed bowl for a value of 1 i.e. if i
want my files directory and characters in rw
x features for honor here it will be necessary that this number so who is concise forgiveness
swear this summit like that we encrypt by default if I define absolutely nothing
then it will be displayed whatever happens to a directory will
be displayed and that we will see it another time with typical permissions
but applied to all by default but here in this case you see that if I
want to assign rights with 3/10 jithree value I will have on the
first value here I will have to associate rwx on the saddle from the middle r
wx and on the third era wx also so there to manage that we have the
4 the 2 and the 1 there in this case if we apply
then if I had rwx is quite simple that is to say that 'we have the accumulation so we
add the whole here in this case so rwx in this example there it
corresponds to 7 quai if grw rw so suddenly if I resume my line here
finally it corresponds to 1 6 6 I always go rw on the second so for
groups I also have 6 and at the end I just have r for the other
users users whose smells and
suddenly I have just 1 1 to 4 so suddenly we end up with 664 and there
indeed we're going to be done hop I'm just going to comment on this line here if we
redo our toto status like this do I find here see that
I have my mode here which is zero 664 then the zero we will see that later but
I have 0 664 if I do on one see that I have 775 why so if we
redo our hells rep one who is here what we have so we
said that we arwx for honor for the group we air wx also and
then we arx which will simply correspond to 5 so suddenly when
we do our stats here we find 775 so that will be practical because
it will allow in particular then in a lot of tools of infra ascot for
example, we'll talk about it later, it makes it possible to define rather than change
the rights for one year, we'll be able to define them, we'll see it even afterwards,
too, it's going to be a little more practical, so here we're going to
implement it, except that to implement it we will need
commands first command that we need is to manage the change of
mode so to change mode we will use ch mode if we make a match the
ch mode we will find here the change of see mode with
different options that we will find here among the other
interesting options it will be to pull it open air it will be the recursive mode that is to
say that I have an entire tree structure and on this whole tree structure for
example I want apply read write read write
775 we're going to say I haven't detailed it for you well I'm going to be able to make
a dash in the open air and I'm going to apply it everywhere if I want to
make it executable everywhere too but I'm going to be able make a dash
in the open air and I will also be able to apply
the the set you have the shot is small it is also which can be practical it is
a verbose mode but which will only display the modifications which are going to
be made so here we go use so
in this case here we are going to make a ch mode and ch mode so we have different
ways of being able to use it we will be able to use it either in
human form or in octal form so if we want to do it in octal form so there
I have already been able to tell you what we had on a dish
so totals here you see that me what I want to do tothova it's very
simple we're going to apply it everywhere read/write executable so to
do that we're going to do a ch mode 777 so rwx and on toto like this
so there if I do it again it is unreal you see then in addition my color has
changed we have we have the coloring which vary and there you see that I find
father well w xrw xrw x if I want to modify for example
we are going here we are going to delete all the because acts how executable
of the whole so both the honor the group and the other milk saw that
suddenly I went here in 666 that is to say that I removed 1 and if I remove
one when we go back to our table here it amounts to removing
x6 I remove 4 for example here that there are only two left
so if I apply the same thing here I remove 4 say that I do
222 and well behind I will have removed
the 4 it is to say reading and suddenly I only have writing everywhere
if I don't want to use the octal mode here I don't feel very very
comfortable with it and well I will be able to
manage things from one another way I'm going to be able to do a ch mode and for
example if I return things we said that we were in yeah here I
want to put the reading back everywhere on toto I'm going to be able to do a more r the
most r it's okay it's going to look what is currently happening on our know
permission and it will add the read character on it if I put a
plus x its added value also unfortunately as we did not specify sailboats of did
not specify honor of groups and hauser commands suddenly it means
that the plus x applies to all any user therefore suddenly to l together if
for example here I want to delete the character
written wable for the other users I will do a ch mode
in up aux orres - w de toto au plat unfortunately if I don't read
what I did what is happened is that I removed so can
other for water for other the character written wable on the totals file so
there we are in this condition there if I want to do it just
for the kouassi group I want to do it for the group
and at the same time here I am going to apply the same thing for the group and for the
honor I will do for a hedge for I suddenly and booed I suddenly it
allows me to withdraw it for the whole so suddenly we remove it is everywhere
so that's about all about it so for the ch mode do nc the
recursive mode is very important to remember so there in this case we have no
wind can create a coach in rennes 1 and we will create a file a for example
so if I do a it is unreal in the ground for example honda j I did it in
recursive mode you see so I find here the rights on my rep 1
which are here my europe 1 he has his rights if we find in particular 775 and
behind here we are in line at that is to say that we is in
664 is behind so if I want to change his rights both for the coi for
the set of rep 1 so what we are going to do we are going to make a big change
here we are going to pass a chu mode six years for example and there I'm going to pass a
dash in the fresh air on reindeer 1 on the dish oh yes I don't have the rights
it doesn't matter to me the mayor like this
so don't worry due to a pager don't type don't worry about what
I'm doing here we will we will see very soon what south represents or
therefore south or for soft super user and there in this case if I f ais she
is unreal r ah yes because yeah ok then it was not the good example to
achieve at all it does not matter
so I made a top 6 it is time that they reacted like that we are going to do
a ch mode before
mode [Music]
17.1 of file ah
yeah it does not matter there we will go into too many details afterwards if I want
to explain it does not matter then so we will return to our directory of to our
file simple totals here our totals file yeah because
I'm not going to go into the details otherwise well then our
totals file here it has its rights here and it has this honor and soyuz hours except that
what is happening happens if I want to change honor from honor and
groups and user from honor or group so we have at the linux level the
notion of the user of users so it's users for example oki
but there are some there are many others on the machine, we also have
the notion of a group, the groups bring together several users and
suddenly we end up with the possibility ibility to give rights therefore of honor
therefore to specifically manage the case of a user on this file there and
generally give him the most advanced rights of course therefore generally
the rights which are here are more advanced than those which are there which are
more advanced than those who are here and here we have the group the group him
generally it will be other users of course than this
user where this user there but he will have a particular case which will
therefore apply there that is what happens if, for example, I want to change
group to change group we will use then we can use
challenge group which will allow group modifications to be made or
else we have read challenge rhône which allows us
to change honor i.e. of the user who is here in
this case the if we want to change users I did not use black
and elevation of privileges without doing it so it does not matter there for
example if i want to give 'user so we had seen
the road user who is the one who runs and the case the most rights
on the machine so all the rights on the machine there in this case I
will be able to specify the user like these and then
possibly apply here foo like these and there of course we need
permissions don't want to explain to you the notions of permissions escape from what
derivation of privileges right away so there we will be able to change
users of foo if at the same time I want to change users let's admit
that it's not at kiki we are the owner but if I want to change both
owners and group at the same time for example there is a group
called sud where is I can apply these h hne oki for the
honor and south or for the group like this so there if I redo it is drawn
it is simply you see who if the group has changed and the group
has become south where the same way if for example I did not want is not change
the user and I want to put it back to the group oki not what I do is that
the separator that she colon I have not read anything m before is on the other hand I
put him or who simply is here if he make you shoot her you see
that suddenly I find myself as if for that very rarely united 6 the chad
group we will rather use the ch hawn and we will use it both for the
groups and for the honors that's why I'm not asking you too much about the
group challenge here so I hope you liked this video don't hesitate to
share to put blue shoots commented on me I'll tell you see you very soon
on the harkis
تصفح المزيد من مقاطع الفيديو ذات الصلة
5.0 / 5 (0 votes)