Edit, Add, And Delete Users With Terminal
Hey guys, this is Mads 101. Today I'm going to show you how to do a few things involving user accounts through Terminal. First of all, I'm going to be showing you how to add a user account in Terminal, and yes, I am logged in as root to do this.
First of all, you want to type dscl space dot space create space /users/
and then I'll make the username test
. uid 701
, sorry about that, spelled create wrong. Okay, I'll put this command along with the others I'm about to type in the description. You can change the uid
to be any number you want; it has to be a unique number that no other user account has, so I'm going to make it 700.
Okay, you also want to type the GID
, so you want to type the same thing, except replace GID
and uid
with GID
. Okay, then you want to type instead of GID
, whatever you want to type shell space /bin/bash
. In this case, hit enter.
Let me think. Um, you want to get rid of shell
and everything after shell
, then you can type home
. I'm going to do /users/test
. Okay, then you want to type real name
, and all of these commands I will put out in the description of this video. So don't try to get what I'm saying or try to look at the video; just do it this way.
Then real name space "test user"
. Close quote. Okay, and there's just one more thing we have to do. Okay, GID
, I already did the GID
. Um, passwd space backslash*
, and we hit enter.
Okay, so now you want to type passwd space
and then the username test new password
, and I'll just make the password password
. Okay, so now I've basically added the user called test
. Here's all the code I've done to do this, and I'm zooming in, of course. But um, I will put all this code in the description of this video, and I will have a website with all this code, so you can just click the link in the description of this video to go to download the code. I've typed the exact terminal output.
Okay, so now what we want to do is basically make a new home folder for this user. So basically, you want to say, and this is pretty simple: cp -R "SL system/Library/ususer template/english.PR"
then close quote. Then you want to type /users/
and then the username we created. I'll do test
.
Okay, so now, in the login window, there will be a new user called test
. Um, so basically now, what you want to do is you want to say chown
and then the username colon the username again. I'll do test:test test:/users/test
. Oops, sorry, okay. So right here, we've um, here's the actual command: chown test:sl user:test
.
So now when we type su test
, if we're not an admin, um then yeah. But basically, here's the default username test
. So I'll just um, here's how to delete a user as well. You type ds space . space delete space /users/
and then the username test
.
Okay, and that's deleted the user test
. And um, so yeah, um here's also um how to, sorry, I just deleted the user test
. How to grant a user administrator privileges. You want to type ds space . space merge space /groups/admin space users space
and then the username. I'm going to make Mac heads 101
an admin.
Okay, so now Mac heads 101
is an administrator. Um, let me just test out this. Okay, so all this code will be in the description of this video, all the code I used to make the user test
and to make a user basically not an administrator. Um, so this is pretty simple.
Okay, so now all you have to do is this code and it'll add, delete, or change users' passwords. I'll have all the code in the description of this video, so um just look at that code. Don't try to figure out what I said, just look at the code because it's more complicated than what I was talking about. So basically, just that's how to add a new user account on the computer.
So um, thank you for watching Mads 101, and subscribe, and goodbye!