Тёмный

Linux Sysadmin Basics -- Linux File Permissions 

tutoriaLinux
Подписаться 207 тыс.
Просмотров 121 тыс.
50% 1

How do file permissions work on Linux? How can I make a Linux file readable or executable? This is a basic overview (without diving into Binary notation) of Linux and Unix file permissions. In other words, you'll finally be able to decode everything you see when you type "ls -l".
My step-by-step project-based Linux course for beginners: www.udemy.com/course/hands-on...
Free Linux Sysadmin Course Playlist: • The Linux Basics Cours...
DigitalOcean referral link: m.do.co/c/0380a1db56a6
Patreon: / tutorialinux
Official Site & e-mail list: tutorialinux.com/
Twitter: / tutorialinux
Facebook: / tutorialinux
Podcast: kernelpanicpodcast.com

Наука

Опубликовано:

 

6 май 2014

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 99   
@VperVendetta1992
@VperVendetta1992 9 лет назад
Read=4 Write=2 Xecute=1 It's not that difficult. You just add the ones you want: 4+2+1 = (r+w+x) = 7 4+2 = (r+w) = 6 4+1 = (r+x) = 5 4 = (r) = 4 2+1 = (w+x) = 3 2 = (w) = 2 1 = (x) = 1
@DudeSkinnyTall
@DudeSkinnyTall 9 лет назад
Nice and easy way to put it, thx. I'm still curious about umask though, do I need to type in "026" in order to give no permissions to "others"? What about executables?
@VperVendetta1992
@VperVendetta1992 9 лет назад
DudeSkinnyTall umask is the inverse of chmod. The max for chmod is 777. The max for umask is 000 (because 777 - 000 = 777). So 026 means ALL permissions to you: (first number = 0; 7 - 0 = 7), Read and Xecute for your group: (second number = 2; 7 - 2 = 5), and just Xecute for other users: (third number = 6; 7 - 6 = 1). In order to give all permissions to you and your group and no permission to others, the number is 007. To give all permissions to you and nobody else, 077. Executables are files like everything else, so they work in the same way. Everything in Linux is a file, directories and executables included.
@HadToChangeMyName_YoutubeSucks
Actually your information per umask is incorrect. The file base permission is 666, not 777, as that would create security concerns. That's why umask of 022 creates files with 644 permissions (rw-r--r--). Because for a directory to be descendable the execute bit must be set, so directory base permission is 777, thus when you create a directory once combined with umask it is 755 (drwxrx-rx-).
@casperes0912
@casperes0912 7 лет назад
Only problem is I always forget which numbers are which. Most intuitive to me would be read 1, write 2 execute 4
@waltcms
@waltcms 7 лет назад
What it the difference between using this method and "ugo"
@balsabjelogrlic4630
@balsabjelogrlic4630 7 лет назад
made it this far and I'm thinking, this guy dedicated all this time to explain Linux without any payoff , thank you so much man! Very helpful videos, cheers! :)
@tutoriaLinux
@tutoriaLinux 7 лет назад
Heh, I really enjoy what I do :-D
@DominiqueWillkins
@DominiqueWillkins 5 лет назад
I want to thank you as well. I have learned a lot in the past three weeks, and i found it very damn interesting. THANKS!
@tramellmalone9146
@tramellmalone9146 4 года назад
@@tutoriaLinux Trust that you have been a blessing to many. :-) Thanks a bunch!!!
@berkelunstad1508
@berkelunstad1508 4 года назад
Thanks for the video, it was super helpful. The one thing I would add would be an easy way to remember the different chmod values without having to look them up. Each number 0-7 represents an addition of 0 to 3 of the following numbers: 4 represents read, 2 represents write, 1 represents execute. So a 6 means rw- (4+2) and a 2 means -w- and a 0 means --- and so on. Edit: In retrospect this is just because of binary, rwx = 111 and r-x = 101 and so on. I didn't realize this until the next morning. Perhaps this is why I shouldn't try to learn Linux at midnight lol.
@usingvancedplzdontban1128
@usingvancedplzdontban1128 4 года назад
chmod notations @ 3;20: (easier to memorize in descending order actually) 0: - - - (no rights at all) 1: - - x 2: - w - 3: - w x 4: r - - 5: r - x 6: r w - 7: r w x
@J0nDaFr3aK
@J0nDaFr3aK 3 года назад
By playing around with chmod, I've found out that you need to have both read and execute privileges in order to view the directory content and file attributes. Setting the value to 1 (execute only) will lock you out of the directory, preventing you to see its content. Setting the value to 4 (read only) allows you to see the directory contents but the file attributes aren't accessible. Cool, lots of new stuff learned today, thanks.
@BorrellRicard
@BorrellRicard 9 лет назад
Thank you for these videos. I work in a research group in Computational Fluid Dynamics, we all use Linux and supercomputers but most of us learn just what we need and much less that what could be useful for us. Definitely, I'll recommend your entire course to new students coming to our lab.
@nadiakateb3670
@nadiakateb3670 4 года назад
Thank you so much sir !!! I've seen a lot of videos about linux on youtube and yours are the best. You have a an incredible way for making everything so simple and easy to understand.
@classicsagat
@classicsagat 3 года назад
Been enjoying this Linux series! All of this has been really informative and well structured, thank you so much!
@saltdomeguy
@saltdomeguy 2 года назад
Loving this series Dave. New to Linux, so this is gold. Thanks!
@habituallearner7680
@habituallearner7680 3 года назад
Thanks so much. It's very kind and thoughtful of you to create and update this series. It's quite comprehensive and is a great review for me.
@klaraschumann4164
@klaraschumann4164 4 года назад
Your videos really are an eye opener. Thanks for the effort.
@AbdulRahman-cb8rc
@AbdulRahman-cb8rc 5 лет назад
Thank you for teaching flawlessly
@GabrielMartinez-ez9ue
@GabrielMartinez-ez9ue 3 года назад
Excellent. I have been following your tutorials with a book called: Linux Pocket Guide. Thank you
@nikolamilic6378
@nikolamilic6378 4 года назад
These videos are the best...you too. Thx a lot!
@litgeeksquadofficial
@litgeeksquadofficial 5 лет назад
Really digging these videos!
@kennethnicklowicz1030
@kennethnicklowicz1030 8 лет назад
Amazing the moment you realize you've been using CHMOD and have an idea now what its actually doing KUDOS!
@PunmasterSTP
@PunmasterSTP Год назад
Permissions? More like “Perfect explanations!”
@Stevesteacher
@Stevesteacher 4 года назад
Amazing, this helped me so much with chmod! thank you :)
@manningermani
@manningermani 8 лет назад
if you don't want to learn the numbers you can use 'chmod u+x script' for example, to add execute rights to the user
@waltcms
@waltcms 7 лет назад
Is there a difference between using the two? I am already used to "chmod ugo" but am I selling myself short by not using or learning the numerical way of doing this? And will employers look down on using the "ugo" method?
@turbasammal
@turbasammal 6 лет назад
No, there is no difference. Just use what you like the most.
@eoinkehoe6981
@eoinkehoe6981 4 года назад
Thank you very much from Ireland!
@abhimanyuvi
@abhimanyuvi 5 лет назад
Hats off to you sir, very nice videos thanks for making such nice videos
@patrickvidican9316
@patrickvidican9316 10 лет назад
thank you for making these videos wow
@tutoriaLinux
@tutoriaLinux 10 лет назад
You're welcome! I'm currently traveling, but more videos are coming soon!
@wackaeleanor196
@wackaeleanor196 5 лет назад
I am glad I found you.
@lobotplays
@lobotplays 10 лет назад
Very helpful. Thank you.
@newwavex8665
@newwavex8665 4 года назад
Could you do a video on binary and octal notation? I have a hard time understanding it, aswell as hexadecimal
@danielgray1073
@danielgray1073 2 года назад
Hey thanks for the great videos! Just one question -- At 0:31 you say we've covered file types. In which video was that? I thinkk ive been watching them in order but maybe I missed one? Thanks! I will look them up on the side anyway!
@danielgray1073
@danielgray1073 2 года назад
ahh so if its d then it is a directory if it is a - than it is a file. nevermind
@arshadkhan9124
@arshadkhan9124 6 лет назад
When i run umask in terminal I get 0002 but in /etc/login.defs umask is set to 022?
@supercooper92
@supercooper92 6 лет назад
So, chmod 2 is the goldilocks of permissions? its just write, Can't unhear 3:34
@ginoginoh
@ginoginoh 7 лет назад
When I create a newfile the default option is rw for owener and only r for the others, but in my login.defs UMASK is setted to 022, so why I don't get 755 but 644? I am on Linux Mint. Thanks for the answer and your videos!
@tutoriaLinux
@tutoriaLinux 7 лет назад
It sounds like the process that created this file has a default of 666 (programs like touch and mkdir don't set the executable bit by default), so the umask is actually applied to the program's 666 in this case, and not the theoretical max of 777. Here's a pretty good explanation of the whole thing: askubuntu.com/questions/44542/what-is-umask-and-how-does-it-work
@ginoginoh
@ginoginoh 7 лет назад
Oh I see! Thanks for your answer!
@craigmackenzie9886
@craigmackenzie9886 5 лет назад
Hey, thanks for the videos. The umask says '0' for user, but users don't have executable privelege on a new file, so it actually is taking something away?
@h4sh92
@h4sh92 4 года назад
Default permissions is 666 for files and 777 for directories.
@garretmkiii
@garretmkiii 4 года назад
So for each owner/group/user there are positions OWNER 2^2, 2^1, 2^0; GROUP 2^2, 2^1, 2^0; and USER 2^2, 2^1, 2^0, where each position can be either 1 or 0 (yes/no, true/false). If position OWNER 2^2 = true (1), file is readable by OWNER, and since the "true" is in position 2^2, it's evaluated as 4. to make a 7, all bits have to be true (1), re: 2^2 + 2^1 + 2^0 = 4 + 2 + 1 = 7, in which case the file can be read, written to and executed for the respective user. And now I'm just going to copy and paste my comment into my RU-vid Course Notes. :P
@stefanspinu5381
@stefanspinu5381 5 лет назад
You said that when you create a file, by default the group category gets the permissions rw-, that is 6. However, in the login.defs you said that we are substracting 2 from 7 for the group category, which leaves the group with permissions of type 5 (that is r-x). Therefore, which one should we believe?
@rleften5788
@rleften5788 5 лет назад
I'm not sure what you are saying here, rw- is 6, and r-x is 5, regardless of which permission it is. Each section, User, Group, Everyone has 3 bits for their permissions. If you are familiar with binary representation, then you know this means we have the following numbers to work with: 4, 2 and 1. Each of the sections are broken down into these 3 bits. So whatever permissions you want, it is a matter of simple maths. Read is 4, Write is 2 and Execute is 1.
@SharvilShastri
@SharvilShastri 5 лет назад
I've got one question. Can we use the chmod command with the pipe keyword I mean say I have a directory 'Abc' which contains lot of files . I'm inside of that directory, now i want to do chmod 777 on all the files. Is there any command for that? I know that I can just cd .. and type chmod 777 -R Abc to give all permissions to all the files along with the directories. But any other method than that. I'm a beginner at this course . Thank you Btw your tutorials are Awesome
@tutoriaLinux
@tutoriaLinux 5 лет назад
Yes! I'd recommend either using 'find' with the -exec flag or the 'xargs' command (which would let you use pipes directly). I just spend 5 minutes looking through my channel and realized there was an xargs video that I filmed last year but never released. I'll try to get that edited and uploaded soon.
@retrosquash
@retrosquash 3 года назад
Lol trying to explain this without explaining bit masking. I applaud you
@user-mo3qn3se8d
@user-mo3qn3se8d Год назад
if i want to change the default file permissions to my needs, i do i do it?
@tiavee
@tiavee 4 месяца назад
Thanks for sharing, but the Umask example confused me. Maybe I need to rewatch it.
@teddymills1
@teddymills1 7 лет назад
I always had a problems with say filename.txt. The file permissions of user=steve and group=staff. Then user Bob who is also in group=staff cannot read or write to filename.txt. Even if I make Bobs primary group=staff, he still cannot write to filename.txt. Filename.txt permissions are 775. Does Bob need read-write access all the way from / root to that path where filename.txt is located ?
@kawo666
@kawo666 7 лет назад
teddy mills Just guessing here, but check if your filename.txt does not actually belong to user=steve group=steve. Then it does not matter that Bob and Steve are in 'staff' group together.
@kawo666
@kawo666 7 лет назад
teddy mills And more importantly, check if the directory the filename.txt is in, belongs to the group 'staff' with all the right permissions. 'chgrp' command might help. As a disclaimer, I am not a Linux professional, just an aficionado ;)
@cptechno
@cptechno 8 лет назад
I find this form the command chmod to be more user-friendly and easier to remember.chmod u=rwx, g=rw,o=r
@ruiruivo83
@ruiruivo83 9 лет назад
QUESTION, Love your videos, could you please teach us how to build the bottom minibar you have on this video?
@tutoriaLinux
@tutoriaLinux 9 лет назад
Ah, that's my fancy window manager (i3) -- I've made some videos about this here: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-9ofq4gpG_lM.html . Enjoy!
@ruiruivo83
@ruiruivo83 9 лет назад
Hope to see python soon. I took your videos as linux classes, wrote notes on paper and everything. Very usefull. Thank you.
@hello-do7pc
@hello-do7pc 5 лет назад
@@tutoriaLinux how did you do the search @ 7:27 ?
@tutoriaLinux
@tutoriaLinux 5 лет назад
Searching for text in nano is done with ctrl-w
@hello-do7pc
@hello-do7pc 5 лет назад
@@tutoriaLinux awesome! Thanks for the tutorials!
@tahirsengine
@tahirsengine 3 года назад
So that's how it goes: rwx => 111(in binary) => 100 + 10 + 1 (Binary) => 4 + 2 + 1(Decimal). So 4 represents r or Read, 2 represents w or Write and 1 represents x or Execute. So if we want to enable r and w then 4+2 = 6. So for self groups and others = > 666
@hwfiori7105
@hwfiori7105 4 года назад
I'm a newbie so sorry if my question is a dumb one, but if I do something like chmod -r 000 / I end up f*king the whole system ? Nobody would have access to anything?
@J0nDaFr3aK
@J0nDaFr3aK 3 года назад
why is it possible to use chmod without super user privileges? can't this possibility be exploited?
@LeemanJ
@LeemanJ 3 года назад
Checks Urban dictionary- "Homeslice" - A very close friend whom you have known for a long time. ..aw shucks :)
@miketh1234
@miketh1234 6 лет назад
Is it correct to refer to characters as bits?
@tutoriaLinux
@tutoriaLinux 6 лет назад
The characters here represent actual bits (0's and 1's) of file metadata that can be turned on or off on a per-file basis.
@andreviniciusbezerradasilv9335
thanks
@ivan4686
@ivan4686 3 года назад
Is this number 6 video in course? Why doesn't it numbered?
@tutoriaLinux
@tutoriaLinux 3 года назад
These were originally numbered but people complained about the titles being cut off on mobile. I've since removed the numbering -- just use the playlist if you want to ensure you're watching in order. Cheers!
@ilyanerad143
@ilyanerad143 7 лет назад
i think for people who are new it would be easier to use chmod with -u -g -o arguments
@waltcms
@waltcms 7 лет назад
I use "ugo" but what is the difference between the two methods?
@miketh1234
@miketh1234 6 лет назад
Why is the "ls" command missing?
@tutoriaLinux
@tutoriaLinux 6 лет назад
Can you elaborate? I'm not sure what you mean.
@miketh1234
@miketh1234 6 лет назад
You typed "ls-" I missed that you typed "-" after "ls", sorry about that, should have investigated more closely. Though perhaps you removed that command for whatever reason. Anyways, thanks for such prompt responses and keep up the great work you have amassed!
@kraljict
@kraljict 2 года назад
I've used both octal notation and symbolic mode and I prefer symbolic. To me, it's a lot more meaningful. There is no need to memorize these arbitrary numbers. Do I know them? I do. But I just prefer the first one. Anyone else? chmod a+rwx file.txt chmod 777 file.txt It's just personal preference, though.
@LinucNerd
@LinucNerd 6 лет назад
Jesus... Now octal makes sense!
@Hogis__
@Hogis__ 5 лет назад
You could've spent the time you were talking about how you don't need to know binary and octal to actually explain it, or direct to a resource. It's not really all that complicated. I explained what the hexadecimal colour values actually mean to my friend in less than 5 minutes and she seemed to understand it well. But thanks for this anyhow, I hadn't understood that the chmod commands people often paste online with numeric values were actually octal representations.
@Hogis__
@Hogis__ 3 года назад
@SS I didn't mean the whole tutorial was bad, I think it was valid criticism
@kshitizgupta3264
@kshitizgupta3264 2 года назад
read, write and execute number annotation could have been better, it is just a sum of the base values of read, write and execute
@christopherrodriguez6545
@christopherrodriguez6545 2 года назад
What you just said makes no sense to a beginner.
@kshitizgupta3264
@kshitizgupta3264 2 года назад
@@christopherrodriguez6545 read 4, write 2, execute 1. Read + write =6 : hence the number Read + execute = 5 hence the same Write + execute = 3 Adding those base numbers in combination will be easy to remember
@ctobi707
@ctobi707 3 года назад
it all clicked when i realised it was octal
@TechnicolorMammoth
@TechnicolorMammoth 5 месяцев назад
Dude, I understand file permissions and you somehow confused me. How each learns as it goes, I guess. I’ve set this playlist on to fall asleep to. This woke me up out of confusion and disappointment.
@hhvazquez
@hhvazquez 3 года назад
What is this sexy bar at the bottom of this Bash session?
@ewan91
@ewan91 7 лет назад
little homeslices (ノ◕ヮ◕)ノ
@TeamKomolo
@TeamKomolo 6 лет назад
No chown? ;)
@tomseinfeld7124
@tomseinfeld7124 4 года назад
I don't understand the group
@arty3514
@arty3514 6 лет назад
mär?
@eatdapoopoo67
@eatdapoopoo67 3 года назад
chmod 666 \m/
Далее
Basic Linux Access Control
6:53
Просмотров 115 тыс.
skibidi toilet 74
07:02
Просмотров 18 млн
How is it possible? 🫢😱 #tiktok #elsarca
00:13
Просмотров 2,2 млн
$10,000 Every Day You Survive In The Wilderness
26:44
Linux Sysadmin Basics -- 6 -- Processes Overview
11:37
Просмотров 137 тыс.
How to use chmod | Manage File Permissions in Linux
15:52
Top 10 Linux Job Interview Questions
16:04
Просмотров 2,3 млн
Linux Sysadmin Basics 02 -- Basic Commands
27:01
Просмотров 430 тыс.
7 Essential Command Line Tools (2022)
9:12
Просмотров 189 тыс.
Linux File permissions and Ownership Explained
11:08
Просмотров 55 тыс.
Linux Crash Course - sudo
26:11
Просмотров 61 тыс.
Избранное печатает....
0:11
Просмотров 50 тыс.
Мой странный компьютер 2024
18:33
Полезные программы для Windows
0:56
How charged your battery?
0:14
Просмотров 2,8 млн