yego.me
💡 Stop wasting time. Read Youtube instead of watch. Download Chrome Extension

Terminal Lesson 4


3m read
·Nov 3, 2024

Mac heads! Um, today I'm going to be showing you about file permissions. You know what this is probably; it's what prevents you from reading another user's home directory. It's what makes it so that other users can't read your files. Um, so let's get started.

Right now I'm in my desktop. You can see, um, I'm going to be showing you how to view the file permissions and what they're based on. So let's start with an ls -l. Here, what this does is it will display us all the file permissions, owners, etc., of directories, etc.

So, um, right here we have documents, and you can see Alex is the owner for that; that's the user that owns documents. And Alex is actually the owner for all of these. Um, and here are the file permissions: d means directory, and that's read write execute. That means I have all the permissions to read, write, and execute my documents. No one else has permissions to do anything on games, just a normal directory. I have all the permissions.

People in my group, so that means other admins, if you're not an admin, that means other simple users will be able to um, execute and read it; that means just you basically read it, and the world can read it can read games. So, or yeah, so directory read write execute. Um, read.

Um, so these are basically what Alex means is that's the owner. The first set of permissions are for the owner; the second are for the group of the owner, and the third are for the world, and that means anyone.

So let me show you how to um, change the owner. First of all, you have to be root to do this. So we're going to do a sudo chown um, and let's make guest own my documents folder here. And um, right now we can see guest right now if we do another ls -l, is the current owner to documents.

So only guest can do anything to my documents folder. That's annoying; that's very annoying! Except I think admins might be. You see, there's a little minus symbol right there; that means I don't have the permissions to view this folder. This error message even comes up; it says I can't do that. It's because it's guest's folder, and I don't have permissions.

So let's do something; I'm going to do a sudo chmod, and what chmod stands for is change mode. And what we're going to do with that is we're going to do 777 documents, and that means that seven basically means read, write, execute. So you can do everything, and seven the first number is the owner, the group, and the world.

So everyone now will be able to read, write, and execute this folder. Now I can open it up, do whatever the hell I want with it! Now let me show you another number that can go instead of seven is five. That means read and write, read and execute, I think, but not write.

So right now we can do an ls -l. You see I can execute and read with the documents, but I cannot write. So let's see right here; I open documents, but I open this, and I change this around. I'm not sure I can do a file save; it says, yeah, I can't do that. I don't have the permissions, so don't save because I can't save it because I can't write.

But now let's just do a chown and let's make myself the owner of this again, Alex documents. And now I own documents, and I'm going to do a chmod 700 for documents. And what this does is it means I can read, write, execute; no one else can do anything.

So let's do an ls -l once again; I own it, thank gosh! And only I can do anything now. By default, other users will be able to read these. The are, so if you really want to secure everything in your home directory, you add a cd to /users, do an ls -l, maybe see who which directory you own; that's probably your home directory. See, guest owns the guest thing, root owns shared, and Alex owns Alex.

So then you do a [Music] chmod 700 Alex, and only you, only you will be able to do anything with Alex. There's a little plus there because it's someone's home directory; it's my home directory.

So now I go back to my desktop, and let me demonstrate. So, I've showed you how to do that. I've shown you how to um, so yeah, you can't really remove something unless you have the proper permissions. That's how to change permissions, how to change the owner.

Um, I think I've got everything down, so um, thanks for watching! Um, I hope you enjoyed the video. Uh, stay in touch with maads. Um, subscribe! Anyway, uh, bye!

More Articles

View All
TOP 10 ECLIPSE DAY Things to know (please share) - Smarter Every Day 174
Hey, I am Destin. If there is one video you want to share about the eclipse, make it this one. Top 10 things you need to know about eclipse day in just a couple of minutes. Number 1 - Know where you’re going to watch the eclipse from. There is this thin…
Top 5 Stocks the “Super Investors” Are Buying in 2022 | Stocks to buy (2022)
There’s an old saying that goes like this: imitation is the sincerest form of flattery. This, for sure, applies to investing. Legendary investor Monish Pabrai puts it a little more direct: he says that there is no shame in getting your investment ideas fr…
A warning about the Uber IPO…
What’s up, guys? It’s Graham here. So, two things. Number one, a picture of my land has been going viral lately on the internet. People are saying it’s like a black hole or something like that. I just want to put this to rest once and for all—it’s just a…
The Tragedy of Freedom | Jean-Paul Sartre
What if we’d get a chance to start a new life? In his short novel Les Jeux Sont Faits, philosopher Jean-Paul Sartre plays with the idea of ‘starting all over’ in the same lifetime, despite the decisions we have made in the past. Even though we have free w…
Running Your Company by Patrick Collison
So Patrick welcome. So Patrick is the co-founder and CEO of Stripe. He launched the startup, we’re now a pretty big company in 2010, correct? With his brother John. Why should we started working on it full-time in 2010? But it actually your comment just t…
Introduction to entropy | Applications of thermodynamics | AP Chemistry | Khan Academy
The concept of entropy is related to the idea of microstates. To think about microstates, let’s consider one mole of an ideal gas. Remember, n represents moles at a specific pressure, volume, and temperature. If the system of gas particles is at equilibri…