Hello, are some people in this lecture we are going to cover how we could access a remote server without
a password using SSL key now remote server, meaning if we have a Linux machine and we want to access
another Linux machine, that another Linux machine is for us is a remote machine.
Now, there are two reasons that we need to access a remote machine without a password.
One is repetitive logging's, meaning if you have a Linux machine, A and you log into Linux machine,
be like 10 times or 20 times a day and you don't want to enter username and password again and again,
then you will generate SASE key.
Second reason, which is the the more important reason is automation through a script.
If you have scripts run that are sitting on on your server AI and you need to execute those scripts
on server B, so that is the automation that will run on B, but every time you run, run it from A
to B, it will prompt a username and password.
And of course this is an everyday thing and you don't want to have any type of interaction with it.
So that is why you create Sisisky.
So the automation will take place by itself without any human interaction.
Now keys are generated at the user level, so you could generate keys like your own self or as a regular
user.
In my case, it could be generated as I have solid user or you could generate the keys at the root level.
So if you want to log in from A to B through route, you can also generate the keys for root.
So the next time when you log in as root, it's now going to prompt you for your username and password.
Now let me put it in a graphical way.
So I saw it this way I could make you understand what are we trying to achieve here?
So let's say you have a server or are Linux machine and I'm going to call it my first Linux machine.
And by the way, this is the actual hostname I have for my Linux machine.
And this machine wants to access another Linux machine.
And that hostname of that, another Linux machine is Linux Center was seven.
I have both of these lengths, machine setup and ready for me to do this testing for this lecture.
Now, if you have only one Linux machine at this time, then you can either skip this lecture or come
back to it.
When you have another second machine.
I would recommend you that you should build another Linux machine and name it, lets say send Linux
into a seven or whatever that you want to call it.
So you could actually practice this lecture on the second Linux machine anyway.
Now the client, which is my first Linux machine, wants to access the server.
Linux sent to a seven and it accesses through S.H..
Right.
You open up a PUDI, you go from one machine to another or from if you logged into the Linux machine,
you could run a command SSA to log in to a remote machine.
When you log in or when you execute SFH command to remote machine, the remote machines prompt you for
two things username and password.
Right?
So you provide those username and password and then it will it will let you in now.
Now, the purpose of this lecture is what if you try to log in without providing the username and password?
Now for that, what you need to do is you need to generate some keys on your client machine, meaning
that is your authentication.
That includes like your ID or whatever.
You you generate those keys.
That is a combo, a combination of letters and keys and symbols.
When you generate them, you copy those keys over to the server and you tell the server, hey, this
is my authentication, so go ahead and keep that that key that I've generated.
Go ahead and keep it.
And you authorized key file.
Then once that is copied over the next time the client tried to log in from my first Linux VM to Linux
Sento seven or S.H., then it will not prompt that that that user Forge's username and password.
Now that is how I could put it.
And from machine to machine now in a regular way in everyday life, to make it more simpler, I will
give you a scenario of a user or someone who wants to access a building or a house.
That person goes into the house and first thing they do is if they don't have keys or access to that
house or that building, they ring a bell or they meet the the security guard and then they give them
the authentication and make sure it is verified and then you come in.
Now, another way you could do is next time you want to come.
Can you give some type of keys like you already go through your background check, you already go through
the verification process and then you give those verification process to the security team or whoever
homeowner of that building, you give it to them then next time and you come in, you know, you won't
be prompted for using your password.
All you have to do may be flash your badge or scan it and you use your SO to get this process work.
We have a few steps that we need to follow.
The first step is on the clean machine decline machine is the one that trying to go to the server,
we have to generate the keys.
And for that the command will run is SSA Chadash Kitchen.
The second step is copy that key to the server.
And the command news uses exactly this command, which is SSA Stasch Copy ID space route, because you
generated the keys as root, so you specify as root at the IP address of the server where you copy and
get to then log in from the client.
So now try that.
Now, since you already copied over, I'll go ahead and try to log in to the server using the command
like SSL route at the IP address of the server or SSA Chadash El route and the IP address of the server.
Both commands are the same.
They, they, they actually let you in from one machine to another over the account route.
All right, now enough talking.
Lets go and log in to my Linux machines and I will go ahead and try this process.
Now I have my PUDI terminal open.
This first machine is my first Linux VM, and if you do hostname my first Linux VM and if you do, who
am I?
I'm logged in as root.
Now, what is my IP address I could do if config ENP 083 is the interface where I have my IP address
and you will see my IP address of my client is one eight to one sixty eight one point ninety five.
Now I wanted to go to my server.
This is my server.
It's Hostname is Linux Sento seven.
And I am logged in to that host as root and the IP address of this server is.
Zero as three.
I'll do the same thing and my IP IP address of that server is one to one sixty one point fifty eight.
Now from the client, if I log in to the server using the command Secich route at the IP address of
the server and hit enter, you see, it's prompting me for the password.
That's what we wanted to avoid.
So I'll just control C and get out of it.
Now I'm back into my clean machine, which is my first Linux machine.
Now go ahead and clear the screen.
So this way we could start and run the command in the client SNH Dash Cagen.
Hit enter, it is going to tell you generating public private RSA key peer, if you want to know more
about RSA.
Ours is a mechanism of our authentication level.
If you want to learn more about it, go ahead and search for it.
Enter file in which to save the key.
Now, by default, it is going to save the key in this directory.
But this directory is on the client on its local machine.
If you wanted to change this location, you could specify here, but I would recommend you leave it
default and just simply hit enter.
Next step is asking you to enter passphrase empty for no passphrase.
Now, if you are in the production environment, in the corporate environment of recommend you to put
in a passphrase anything that you like could be a password or anything, a combination of letters.
But we are doing this test in a lab environment, so I'm not going to pick any passphrase.
So I'll just leave that empty and simply hit.
And it's prompting me again saying enter same passwords again.
So I didn't enter anything, so I'm not going to enter it again.
So simply hit enter again.
Now I'd say your ID has been saved in Route DSH, ID and RSA.
So if you had this file, you're going to see the key as this is the key and your public, he has been
saved in Rudolph S.H. ID and Disqualifiers Setup Pub, which is public.
This is a key.
Now, what we need to do is we have already authenticated ourselves.
We have generated the keys.
Now we need to copy this key to our server.
So this time so next time when I log into the server, the server would know and says, oh yeah, I
know you, I have your key so you could come in without a password.
So I have to copy that key.
To do that, I will do a Secich Dash copy ID route.
Is there route account that is on this server?
It's not the route on this client server route at the server IP when I to 160 at one point fifty eight.
You could right click if you're using putty, and it will copy it for you now hit enter.
Now it is going to actually ask you for the password because you are going in for the first time.
And of course, once you add that key, it's going to ask you that as just the last time.
So go ahead.
Put in a password for that account.
And now it's saying that that the Keys has been copied.
Now it's saying now try logging into the machine with one msh root of one eye to 161 to 58 and 58,
remembers my server and check to make sure that only the key you wanted were added.
By the way, that key is added to this server and it is added to router SSA authorized keys.
You could actually go into that that directory route DSH dweller's mysel and you're going to see authorized
keys.
When you do cat on the authorized keys, you're going to see this is this entire key has been copied
and it's copied as route from the machine, my first Linux VM.
So it's already there.
Now if I come in from this machine to this machine, I'm now going to have any problem or is now going
to prompt me for using a password.
Let's go ahead and clear the screen here and let's go ahead.
Clear the screen here.
And now let's go ahead and log in to my server.
S.H. route at 192 168 dot one, dot 58, 58 is the IP of my server.
Let's try again to confirm.
You see 58, OK, now let's go ahead and enter.
Bingo.
See, I am logged in, it didn't prompt me for any user name, it didn't prompt me for any password
and I'm logged in.
And if you do hostname, you're going to see I am in Linux sent to US seven, which is this machine.
You could also do the other command, Exito.
Now, you back into your client, my first Linux VM, you could do the second command associate, by
the way, both commands performs the same function.
192 to 168, one to 58, and I'm logged in to the Linux Center SVM, so that's how the logging into
a remote machine without password works, you have to generate the keys on the machine that is trying
to log in, give these keys to the server where you're trying to log in to.
And then once these keys are passed over, you could try next time you log in.
It's not going to prompt you for any username or password.
And then you could run many, many different automated scripts and commands without the nonsense of
going in and putting in the Usenet password.
Anyway, I hope this lecture serves its purpose.
If you have any questions, let me know.
Good luck.