1 00:00:00,170 --> 00:00:01,160 Hello, everyone. 2 00:00:01,280 --> 00:00:07,640 In this demo, I'm going to show you how to use SCP command and SSH command. 3 00:00:08,610 --> 00:00:11,310 SCP is a secure copy protocol. 4 00:00:11,640 --> 00:00:19,290 It copies and transfers files on a network between two machines or between a client and a server. 5 00:00:19,500 --> 00:00:22,890 As we can see here on the screen, I'm using Tmax. 6 00:00:22,920 --> 00:00:33,360 It's a terminal Multiplexers On the left side, the local machine and the user who is user student TWD. 7 00:00:33,570 --> 00:00:35,940 I'm going to print the current working directory. 8 00:00:36,750 --> 00:00:42,420 As we can see here, here is the list of the files and directories on the local machine. 9 00:00:42,570 --> 00:00:45,330 Now I'm going to the remote machine. 10 00:00:45,720 --> 00:00:48,180 Who am I? 11 00:00:48,210 --> 00:00:49,620 So this is the remote machine. 12 00:00:49,620 --> 00:00:50,820 The user remote. 13 00:00:51,060 --> 00:01:01,990 Then we have the slash home slash remote, then lSl, the list of the files and directories. 14 00:01:02,020 --> 00:01:04,050 I have only two directories. 15 00:01:04,290 --> 00:01:07,930 Now, I'd like to show the IP address here. 16 00:01:07,930 --> 00:01:08,680 Show. 17 00:01:09,250 --> 00:01:10,630 So IP address. 18 00:01:10,630 --> 00:01:10,900 Show. 19 00:01:10,900 --> 00:01:13,720 Then the interface hit enter. 20 00:01:13,750 --> 00:01:18,580 This is the IP address of the remote machine or the server machine. 21 00:01:19,390 --> 00:01:25,840 Going back to the current or the local machine here, first I would like to create. 22 00:01:26,510 --> 00:01:29,810 A text file, so I'm going to call this text file. 23 00:01:30,590 --> 00:01:34,220 Uh, test one. 24 00:01:35,310 --> 00:01:36,240 The text. 25 00:01:37,960 --> 00:01:39,280 Then hit Enter. 26 00:01:39,280 --> 00:01:43,060 I'm going to write Hello world. 27 00:01:49,160 --> 00:01:55,010 Then that test one dot txt. 28 00:01:55,370 --> 00:01:55,940 Perfect. 29 00:01:55,940 --> 00:01:58,160 Cat test one. 30 00:01:59,070 --> 00:02:03,720 I have the text here inside this text file. 31 00:02:03,870 --> 00:02:08,940 Now, I would like to transfer this text file to the remote machine. 32 00:02:09,330 --> 00:02:18,300 So since I'm using the student account here, I have to use the sudo command before the SCP command. 33 00:02:18,360 --> 00:02:21,510 Then the name of the text file test one. 34 00:02:21,870 --> 00:02:22,590 The TXT. 35 00:02:23,530 --> 00:02:25,270 Then the IP address. 36 00:02:26,630 --> 00:02:27,680 On the remote. 37 00:02:28,460 --> 00:02:29,810 Or their server machine. 38 00:02:29,810 --> 00:02:36,500 172.61.1. 1 or 1 then calling slash. 39 00:02:37,410 --> 00:02:40,860 The current working directory here in the remote machine home. 40 00:02:41,970 --> 00:02:43,620 Slash remote. 41 00:02:44,430 --> 00:02:44,880 Hit. 42 00:02:44,880 --> 00:02:45,480 Enter. 43 00:02:45,510 --> 00:02:48,150 Now I have to type my password first. 44 00:02:48,180 --> 00:02:51,360 Then I have to type the root password on the. 45 00:02:54,280 --> 00:02:56,290 On the remote machine with the server machine. 46 00:02:56,290 --> 00:02:59,950 So as we can see here, we transfer this file. 47 00:03:00,870 --> 00:03:02,190 To the remote machine. 48 00:03:02,750 --> 00:03:04,140 I'm going there to check. 49 00:03:06,010 --> 00:03:07,230 You can see over here. 50 00:03:07,230 --> 00:03:09,630 This is the test one. 51 00:03:09,630 --> 00:03:13,770 The txt hit enter. 52 00:03:14,340 --> 00:03:23,490 As you can see here we have hello world inside this txt file if I would like to log in as a root user. 53 00:03:24,220 --> 00:03:28,540 On the on the local machine. 54 00:03:28,930 --> 00:03:33,420 I don't have to use the pseudo command, so I'm going to create. 55 00:03:33,430 --> 00:03:35,980 Let me check if I do have a text file here. 56 00:03:36,960 --> 00:03:38,600 Uh, yeah, I think I do. 57 00:03:38,610 --> 00:03:40,770 I'm going to transfer this tax file number. 58 00:03:40,800 --> 00:03:41,280 Okay. 59 00:03:41,910 --> 00:03:47,700 So keep the number for txt IP address. 60 00:03:48,210 --> 00:03:51,840 172.61.1.101. 61 00:03:51,870 --> 00:03:56,040 Then colon slash home slash remote. 62 00:04:01,350 --> 00:04:02,130 Hit enter. 63 00:04:03,000 --> 00:04:09,810 At the buzzword of the this is the buzzword of the remote machine. 64 00:04:10,160 --> 00:04:15,750 So you can see here we transfer this file to the remote machine and I go there to check. 65 00:04:16,410 --> 00:04:22,500 And you can see over here, this is the text file cat number. 66 00:04:23,420 --> 00:04:26,820 So you can see this is the content of this text file. 67 00:04:26,970 --> 00:04:36,000 And going back to the local machine, as you can see here, this is the content. 68 00:04:37,720 --> 00:04:38,980 Inside this text file. 69 00:04:41,180 --> 00:04:42,330 So far, so good. 70 00:04:42,350 --> 00:04:42,840 Perfect. 71 00:04:42,860 --> 00:04:46,380 Now I'm going to move on to the next command, the SSH command. 72 00:04:46,400 --> 00:04:54,620 So the SSH command provides a secure, encrypted remote connection between two machines or between a 73 00:04:54,620 --> 00:04:56,030 client and a server. 74 00:04:57,200 --> 00:05:01,490 So right now I'm in the local machine. 75 00:05:01,490 --> 00:05:04,670 I would like to use the SSH in order to. 76 00:05:05,440 --> 00:05:08,800 Get an axis or connection to this machine. 77 00:05:09,220 --> 00:05:16,480 So what I'm going to do, I'm going to type SSH space, then the user remote. 78 00:05:18,120 --> 00:05:24,660 Then add the IP address that 16 .1.101. 79 00:05:24,990 --> 00:05:27,970 This is the IP address of the remote machine. 80 00:05:27,990 --> 00:05:28,800 Hit enter. 81 00:05:29,910 --> 00:05:32,010 Yes, I'm going to type the password right now. 82 00:05:32,220 --> 00:05:41,910 As we can see here, I get connection right now from my local machine to the remote machine or the server. 83 00:05:42,100 --> 00:05:45,780 lSl can see here the content. 84 00:05:47,310 --> 00:05:50,900 Going back to the clear. 85 00:05:52,470 --> 00:05:53,730 This is the remote machine. 86 00:05:53,730 --> 00:05:55,050 As we can see here. 87 00:05:55,860 --> 00:05:59,070 I have the same files and the directories. 88 00:05:59,900 --> 00:06:01,580 On the remote machine. 89 00:06:01,580 --> 00:06:04,820 So I get an access and a connection to access that machine. 90 00:06:05,420 --> 00:06:08,510 Now I'm going to go back here, exit. 91 00:06:08,510 --> 00:06:10,460 So I'm going to exit the connection. 92 00:06:10,460 --> 00:06:11,120 Clear. 93 00:06:12,150 --> 00:06:19,200 As we can see here every time, if I would like to get a connection, I have to type the password. 94 00:06:20,440 --> 00:06:21,310 One, two, three. 95 00:06:21,610 --> 00:06:25,210 Now we got an access there if I don't like to. 96 00:06:26,760 --> 00:06:28,590 Type or enter a password. 97 00:06:29,790 --> 00:06:32,250 From my local machine to the remote machine. 98 00:06:32,250 --> 00:06:38,910 I can do that by using the SSH key generator and also the SSH copy ID. 99 00:06:39,720 --> 00:06:40,980 Let's do that. 100 00:06:41,430 --> 00:06:44,940 So first what I'm going to do, I'm going to exit here. 101 00:06:44,940 --> 00:06:54,000 I would like to log in and send the ssh ssh key generator from the student account and the local machine 102 00:06:54,000 --> 00:06:55,890 to the remote machine. 103 00:06:56,640 --> 00:07:04,230 Alice I'm going to LA just to make sure that I don't have have this one just. 104 00:07:04,230 --> 00:07:05,910 I want to remove this one here. 105 00:07:06,240 --> 00:07:06,780 That. 106 00:07:06,870 --> 00:07:07,580 Ssh. 107 00:07:07,620 --> 00:07:08,250 Perfect. 108 00:07:08,280 --> 00:07:08,880 Clear. 109 00:07:09,180 --> 00:07:11,820 Now I want to create the first step. 110 00:07:11,820 --> 00:07:17,490 I need to create a public private key using the ssh ssh key generate. 111 00:07:20,800 --> 00:07:22,660 In order to use this one. 112 00:07:23,850 --> 00:07:26,520 To the in order to use the key generate. 113 00:07:27,610 --> 00:07:30,010 To access the remote machine. 114 00:07:30,490 --> 00:07:32,950 First, I need to type this command. 115 00:07:33,010 --> 00:07:33,580 Ssh. 116 00:07:33,600 --> 00:07:36,290 Dash key, generate and hit enter. 117 00:07:36,310 --> 00:07:39,820 It would ask me if I would like to keep. 118 00:07:39,970 --> 00:07:45,460 Or save the public and the private IP keys. 119 00:07:46,090 --> 00:07:48,550 And under this file. 120 00:07:49,500 --> 00:07:55,230 And under this text or I need to create another one, I want to just use the default. 121 00:07:55,230 --> 00:07:56,550 So I'm going to hit Enter. 122 00:07:56,550 --> 00:07:59,760 Now it's going to ask me if I would like to type any password. 123 00:07:59,760 --> 00:08:00,630 I don't want any. 124 00:08:00,630 --> 00:08:03,150 I don't want to type any password hit enter. 125 00:08:03,150 --> 00:08:05,070 And the same thing I hit enter. 126 00:08:05,070 --> 00:08:08,280 As we can see here, we have created it. 127 00:08:08,310 --> 00:08:11,460 What private and public key. 128 00:08:12,240 --> 00:08:13,530 How I can check that. 129 00:08:13,530 --> 00:08:15,090 So I'm going to. 130 00:08:15,120 --> 00:08:17,550 There is a hidden file CD. 131 00:08:18,560 --> 00:08:22,240 That's is h hit enter lSl. 132 00:08:22,490 --> 00:08:26,050 As we can see here, we have the private and public key. 133 00:08:26,060 --> 00:08:28,970 So this is the public key and this is the private key. 134 00:08:29,930 --> 00:08:31,520 The next step right now. 135 00:08:33,919 --> 00:08:36,140 The next step. 136 00:08:36,140 --> 00:08:39,200 I need to copy the public key to the remote. 137 00:08:39,230 --> 00:08:46,790 Host So now we already generated the private and public key, so I need to copy this key from the local 138 00:08:46,790 --> 00:08:49,010 to the remote machine. 139 00:08:49,010 --> 00:08:51,410 So I'm going to type ssh dash. 140 00:08:51,410 --> 00:08:51,800 Dash. 141 00:08:51,800 --> 00:08:52,430 Copy. 142 00:08:52,670 --> 00:08:54,950 Dash ID then. 143 00:08:56,400 --> 00:09:01,770 I'm going to type the remote at. 144 00:09:01,770 --> 00:09:05,780 So they're going to type the name of the machine here is remote. 145 00:09:05,790 --> 00:09:07,050 Then the IP address. 146 00:09:07,050 --> 00:09:11,640 172 dot 16 .1. 101I hit enter. 147 00:09:11,970 --> 00:09:15,210 Now it's going to ask me Are you sure you want to continue connection? 148 00:09:15,210 --> 00:09:16,530 I said yes. 149 00:09:16,560 --> 00:09:17,490 Hit enter. 150 00:09:18,070 --> 00:09:18,820 Perfect. 151 00:09:20,000 --> 00:09:29,360 Now what I did, I copied my public and private ID from my local machine to the remote machine. 152 00:09:29,360 --> 00:09:31,780 I can go there and double check. 153 00:09:31,790 --> 00:09:33,770 lSl Hit Enter. 154 00:09:34,280 --> 00:09:41,030 Now, as you can see here, we have the text file here or the directory. 155 00:09:41,030 --> 00:09:46,940 So CD So we have the public key and the private key under this directory. 156 00:09:47,030 --> 00:09:48,620 Hit enter ls L. 157 00:09:49,190 --> 00:09:56,540 As we can see here, we get the IP here, the authorized keys from the local host. 158 00:09:58,100 --> 00:09:58,490 Okay. 159 00:09:58,610 --> 00:10:05,240 CD Now I'm going back to the to the local machine. 160 00:10:05,270 --> 00:10:11,750 Now I want to use the SSH without using the password remote. 161 00:10:12,260 --> 00:10:17,780 Then add 172.6 16 .1.101. 162 00:10:17,780 --> 00:10:27,120 I hit enter as we can see here, we logged in without entering a password to the server or to the remote 163 00:10:27,120 --> 00:10:27,720 machine. 164 00:10:30,260 --> 00:10:31,930 Thus conclude our session. 165 00:10:31,940 --> 00:10:34,310 Thank you and see you in the next lesson.