Viewers: in countries Watching now:
Unix for Mac OS X Users unlocks the powerful capabilities of Unix that underlie Mac OS X, teaching how to use command-line syntax to perform common tasks such as file management, data entry, and text manipulation. The course teaches Unix from the ground up, starting with the basics of the command line and graduating to powerful, advanced tools like grep, sed, and xargs. The course shows how to enter commands in Terminal to create, move, copy, and delete files and folders; change file ownership and permissions; view and stop command and application processes; find and edit data within files; and use command-line shortcuts to speed up workflow. Exercise files accompany the course.
In this chapter, we're going to talk about file ownership and privileges. Let's begin by making sure we can answer the question "who am I?" In chapter 1, we talked about how Unix is fundamentally designed to be a multiuser environment, and we've talked about how we log in each time we open a Terminal window. Now in Unix, a user is someone who has an account on the system and each user on the system wants to keep their private files private and only share certain files with others. Otherwise, if everyone has access to everything all the time ,then what's the point of even having logins and user accounts? So fundamental aspect of this multiuser environment is that a user has total access to their own files, limited access to other people's files, and so that we can have collaboration, we have the ability to grant permission to certain files to certain people.
Before we can do that though, we need to understand who we are and in Unix,= we can just simply type whoamI and it will tell you who you are. Now that may seem like a really sort of obvious answer because you're on your Mac. It's just you, you know you're logged in as you, but when you're working in Unix, it isn't always completely clear. You can actually switch users. We'll see how to do that little later. You may be logged into a remote Unix server like a web server. There are Web servers where I can log in as a specific user or I could login as root, and then it's important to know who am I right now.
If you can't do something that you think you ought to be able to do. If you can't open and read a file that you think you ought to have permission to read, well you can just type whoamI as a sort of sanity check to be like oh right, when I started this whole process, I logged in as a different user. I need to exit out and log back in as that other user or switch users so that then I have permission to do the thing that I want do. So it is an important concept in Unix. To keep most of the user's private files, each user gets a home directory. We saw that earlier. We used cd and then the twiddle or tilde as a shortcut and that's the shortcut to get to my home directory for kevin's home directory.
Whoever I'm logged in as that's where it's going to send me. Incidentally, that value is stored in home. So $home, that's where my home directory is. Each user has a different value when they logged in for home. For OS X those are located inside capital users and then the username. On a lot of other Unix systems, it will be home/ and then whatever the username is. So it will be something like that. So just to show you it's not there on the Mac, but that's where it'd live on the Unix systems. So now that we're clear on who we are right now, where we should be putting most of our private files, we are set up well to talk about the idea of file ownership and permission and how we go about changing those.
One thing that we touched on earlier that I want to make sure I mention again is that you can create other users. So you can go to your Apple menu > System Preferences and then from Accounts, you can click lock here to make changes and then click the plus sign and then you will be able to create new users. If you then want to switch and log out as a user, it'll quit all your programs and everything. So anything you have been working on will be gone, but what you'll do is from the Apple menu, you pick Log Out as that user. You don't have to shut down, you don't have to restart, you can just log out. Your Mac is still running. Unix is still running. You've just logged out as one user and it gives you the opportunity to log back in as a different user.
So you can try it out. You can create another user and you can try out a lot of the things that we're going to do here and you'll be able to see how the ownership and permissions affect things. Now you may not want to do that a lot because you are going to have to quit out of everything and then relaunch it all again, but it might be worth doing at some point during the exercises just to watch several of the movies in this chapter and then log out as one user, log back in as a different user, and see what you have the ability to do. Now some of you out there may be thinking "Well, I am the only user on my Mac and I'm always going to be the only user on my Mac and I am not going to work on any remote Unix servers or anything.
So I can skip all this. I don't need to know it." You can't. You really do need to still understand the idea of ownership and permissions because it's such a fundamental part of the way Unix works that you can't work in Unix without understanding how it works and how to manipulate them.
Find answers to the most frequently asked questions about Unix for Mac OS X Users .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.