Full Stack for Front-End Engineers, v2 Setting User Permissions
Transcript from the "Setting User Permissions" Lesson
>> Jem Young: All right, so let's change our home directory, which we did so that's cd tilde.
>> Jem Young: And honestly, I didn't know until I think I was an adult that the squiggle sign is called a tilde. And then the other one, the what he called it? The same one that's on the tilde is called a grave marker that I didn't know either.
[00:00:19] Yeah, I know you learn all sorts of stuff when your run a full stack. What we wanna do is we wanna make a .ssh directory, because our SSH keys are by default in the .ssh directory. We wanna be able to login as this user now, because we're gonna disable root login in a second.
[00:00:39] So mkdir -p, the -p just creates a directory if it doesn't already exist. And then ~/.ssh, so we're creating a .ssh directory. I'm gonna do that here, mkdir -p ~/.ssh. And we do an ls -a, yeah, it'll list out all of our directories. Actually, I think I want -l, no I want -a.
[00:01:13] Anything with a dot in front of it is considered a hidden directory by default. If I do ls nothing shows up, because I have no directories. But when I do an ls -a will see all the hidden directories or hidden files that are in here.
>> Jem Young: Right there.
[00:01:30] So now, we're gonna create a new file, we're gonna use vim. We're gonna create a file called authorized keys, and when we do that we're gonna paste our public key into our authorized key file. Again exactly what we did, how digital ocean sets up your server. It does this for you when you create a root directory, but now we're just doing this for our new user.
[00:01:49] So we can SSH in, so vi ~/.ssh/authorized_keys. I'm going to do that now, hopefully I can spell authorized right, I'm a terrible speller. .ssh/authorized_keys. And from there, I am going to grab my public key from my other terminal, so I'm just gonna
>> Jem Young: I'm just gonna fire. I just opened up another terminal, nothing fancy.
[00:02:25] Actually copied that before but I'm going to CD into my dot safe directory. And then I'm going to cat that I made, so fsfe2. Remember it's the dot pub, and I'm just going to copy this. But I'm just gonna insert, I'm gonna paste that in.
>> Jem Young: And then I'm gonna save it.
>> Jem Young: Everybody with me so far? So you create an authorized key file, and then you paste it in your public key that you wanna SSH into. So vi, we open it to edit, and if a file doesn't exist when you open it with vi, it'll create it for you when you write it, and then just write quit, or yeah.
[00:03:15] I don't like saying write quit, because it sounds like saying right click, but I'll say WQ, UWQ out of it.
>> Jem Young: Right.
>> Jem Young: Everybody good so far? Okay. All right, so now, what we're gonna do is we're gonna exit, and then we're gonna exit. So exiting one time puts us back in a root, cuz all we did when we switched users, we opened a new shell.
[00:03:41] So we're gonna exit out of there, exit again, then we're gonna ssh in with our new user name
>> Jem Young: So exits, then exits, and then
>> Jem Young: Gonna ssh with user name Jem at the IP address.
>> Jem Young: And if I pasted things right, I'm in my server