در حال بارگذاری ...

Day-to-Day SSH Access0:01

So we've created these servers using Forge, and if it was a layer all VPS server, we already tested out the ability to SSH into the terminal, just using a button in the Forge interface. And if you are using something like Digital Ocean, you can also do that in the interface for your server provider, but that's not actually functional to SSH into your project. From a day-to-day basis perspective, that's really more what you're gonna do in cases of emergency.

From a day-to-day basis perspective, that's really more what you're gonna do in cases of emergency. So normally what we're gonna do is we're going to SSH in, in our terminal, or we're going to use our SSH authentication in other places. For example, in our, uh, database connection tool, our database manager, and we're gonna use our SH keys to authenticate when we're there. So you're probably familiar if we've ever done any SSHing before of just going to the terminal

Testing SSH Connection0:38

So you're probably familiar if we've ever done any SSHing before of just going to the terminal and typing SSH user at IP address. So let's just try that out with our new server to see what happens. So we're gonna grab our public IP address, we're gonna go over to terminal. We're gonna say SSH Forge at that permission denied public key. So we don't have the ability

Adding SSH Keys in Forge0:59

permission denied public key. So we don't have the ability to even type in a password when we're SSHing into these projects. We need to have our SSH keys added to our Forge server. So let's still take a look at what that looks like. So with Forge, we have the ability, let me just grab this. We have the ability to add our SSH keys in two places. We can add it to our account, which will mean that it is added to every single server we create in the

We can add it to our account, which will mean that it is added to every single server we create in the future, or we can add it to a specific server. So first let's go over to our account and SSH and we'll create a new key and we'll name this key mats MacBook Pro. And we wanna name this in a way where we can identify it against other machines, but also if this key is added to a team server, we know whose MacBook Pro it is.

but also if this key is added to a team server, we know whose MacBook Pro it is. And that's why I put mats in there. And then we paste our public key in there and then it's there. And so now every server we create and forge in the future, we'll have this SSH key added. But if we go to our existing servers and their SSH keys, we're not gonna see any SSH keys there because those SSH keys weren't on

and their SSH keys, we're not gonna see any SSH keys there because those SSH keys weren't on our account when we created them. So we can also go add key and we can either add it from the account or we can go in and add it manually if we need to. So I'm gonna add from account, I'm gonna choose Matts MacBook Pro, I'm gonna add it, and that will be added to the authenticated users, uh, session of that particular server.

SSH Config Host Aliases2:16

and that will be added to the authenticated users, uh, session of that particular server. So now when we go back to Oregon Trail Production IP address and we type SSH Forge at that IP address or in, it's that easy. And there's one other trick I'd like to show you, which is that I don't always remember those IP addresses. So I use the tilda slash ssh slash config file, which SSH knows to look to. And by default, I do have these things

which SSH knows to look to. And by default, I do have these things that just basically tell it how, uh, what identity files to look to. Um, you don't have to have these, but it is helpful. And what you do is you're just gonna say host and you're gonna put the host name. So this is like a nickname. So I'm gonna say nickname is Oregon. And then you type host name in the IP address,

So I'm gonna say nickname is Oregon. And then you type host name in the IP address, and then User and Forge. And then when you save that, we can now SSH to that host. So Oregon is our nickname, so SSH Oregon. And we're in just a fun little trick for you if you're interested.

دوست دارید گاهی خبرهای Laracasts را ایمیل کنیم؟