Hello, everyone.
In this demo, I'm going to show you how to use SCP command and SSH command.
SCP is a secure copy protocol.
It copies and transfers files on a network between two machines or between a client and a server.
As we can see here on the screen, I'm using Tmax.
It's a terminal Multiplexers On the left side, the local machine and the user who is user student TWD.
I'm going to print the current working directory.
As we can see here, here is the list of the files and directories on the local machine.
Now I'm going to the remote machine.
Who am I?
So this is the remote machine.
The user remote.
Then we have the slash home slash remote, then lSl, the list of the files and directories.
I have only two directories.
Now, I'd like to show the IP address here.
Show.
So IP address.
Show.
Then the interface hit enter.
This is the IP address of the remote machine or the server machine.
Going back to the current or the local machine here, first I would like to create.
A text file, so I'm going to call this text file.
Uh, test one.
The text.
Then hit Enter.
I'm going to write Hello world.
Then that test one dot txt.
Perfect.
Cat test one.
I have the text here inside this text file.
Now, I would like to transfer this text file to the remote machine.
So since I'm using the student account here, I have to use the sudo command before the SCP command.
Then the name of the text file test one.
The TXT.
Then the IP address.
On the remote.
Or their server machine.
172.61.1. 1 or 1 then calling slash.
The current working directory here in the remote machine home.
Slash remote.
Hit.
Enter.
Now I have to type my password first.
Then I have to type the root password on the.
On the remote machine with the server machine.
So as we can see here, we transfer this file.
To the remote machine.
I'm going there to check.
You can see over here.
This is the test one.
The txt hit enter.
As you can see here we have hello world inside this txt file if I would like to log in as a root user.
On the on the local machine.
I don't have to use the pseudo command, so I'm going to create.
Let me check if I do have a text file here.
Uh, yeah, I think I do.
I'm going to transfer this tax file number.
Okay.
So keep the number for txt IP address.
172.61.1.101.
Then colon slash home slash remote.
Hit enter.
At the buzzword of the this is the buzzword of the remote machine.
So you can see here we transfer this file to the remote machine and I go there to check.
And you can see over here, this is the text file cat number.
So you can see this is the content of this text file.
And going back to the local machine, as you can see here, this is the content.
Inside this text file.
So far, so good.
Perfect.
Now I'm going to move on to the next command, the SSH command.
So the SSH command provides a secure, encrypted remote connection between two machines or between a
client and a server.
So right now I'm in the local machine.
I would like to use the SSH in order to.
Get an axis or connection to this machine.
So what I'm going to do, I'm going to type SSH space, then the user remote.
Then add the IP address that 16 .1.101.
This is the IP address of the remote machine.
Hit enter.
Yes, I'm going to type the password right now.
As we can see here, I get connection right now from my local machine to the remote machine or the server.
lSl can see here the content.
Going back to the clear.
This is the remote machine.
As we can see here.
I have the same files and the directories.
On the remote machine.
So I get an access and a connection to access that machine.
Now I'm going to go back here, exit.
So I'm going to exit the connection.
Clear.
As we can see here every time, if I would like to get a connection, I have to type the password.
One, two, three.
Now we got an access there if I don't like to.
Type or enter a password.
From my local machine to the remote machine.
I can do that by using the SSH key generator and also the SSH copy ID.
Let's do that.
So first what I'm going to do, I'm going to exit here.
I would like to log in and send the ssh ssh key generator from the student account and the local machine
to the remote machine.
Alice I'm going to LA just to make sure that I don't have have this one just.
I want to remove this one here.
That.
Ssh.
Perfect.
Clear.
Now I want to create the first step.
I need to create a public private key using the ssh ssh key generate.
In order to use this one.
To the in order to use the key generate.
To access the remote machine.
First, I need to type this command.
Ssh.
Dash key, generate and hit enter.
It would ask me if I would like to keep.
Or save the public and the private IP keys.
And under this file.
And under this text or I need to create another one, I want to just use the default.
So I'm going to hit Enter.
Now it's going to ask me if I would like to type any password.
I don't want any.
I don't want to type any password hit enter.
And the same thing I hit enter.
As we can see here, we have created it.
What private and public key.
How I can check that.
So I'm going to.
There is a hidden file CD.
That's is h hit enter lSl.
As we can see here, we have the private and public key.
So this is the public key and this is the private key.
The next step right now.
The next step.
I need to copy the public key to the remote.
Host So now we already generated the private and public key, so I need to copy this key from the local
to the remote machine.
So I'm going to type ssh dash.
Dash.
Copy.
Dash ID then.
I'm going to type the remote at.
So they're going to type the name of the machine here is remote.
Then the IP address.
172 dot 16 .1. 101I hit enter.
Now it's going to ask me Are you sure you want to continue connection?
I said yes.
Hit enter.
Perfect.
Now what I did, I copied my public and private ID from my local machine to the remote machine.
I can go there and double check.
lSl Hit Enter.
Now, as you can see here, we have the text file here or the directory.
So CD So we have the public key and the private key under this directory.
Hit enter ls L.
As we can see here, we get the IP here, the authorized keys from the local host.
Okay.
CD Now I'm going back to the to the local machine.
Now I want to use the SSH without using the password remote.
Then add 172.6 16 .1.101.
I hit enter as we can see here, we logged in without entering a password to the server or to the remote
machine.
Thus conclude our session.
Thank you and see you in the next lesson.