School Of Basics | What is SSH | How SSH works

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello and welcome I am Raghav and today we're going to learn in a very basic and a very interesting way what exactly is SSH and in case you have never heard this word or you have never understood exactly what SSH is do not worry in this video I am going to explain everything about SSH from scratch so SSH to start with is an acronym for secure shell and basically in very simple words it is a protocol that allows two or more machines to talk to each other over a network in a secure way so there are two important things here it is a it is a protocol So protocol is a set of rules or guidelines so there are some set of rules and guidelines in ssh and it allows two machines to talk or access Each Other security over a network so this is another important thing that you should always remember it is over a network like internet it is not like 2 machines are connected directly it is happening over a network where we have a client and we have a server so here we have a client and server the server is a remote machine and the client is our local machine and from our local machine we access the remote machine or transfer or communicate information or Exchange data between each other so this is in very simple words what SSH is now to understand exactly why did we need it Let us step back a little in history and understand how did it all started so we had a need for two systems or two machines to talk to each other and way back in 1960s there was a technology or a process developed called TELNET so this is Telnet and it was in 1960s when this was created and this was again a protocol for two machines to access each other or talk to each other or communicate but this was not a secure way so this was a very great invention but the only problem was as we moved to the internet Era and two machines needed to be accessed over a network over internet Telnet was no longer a secure way or a secure option for this communication and therefore in 1990s and 1995 to be very specific SSH was invented and created and this was a secure way for two machines to talk to each other or access information or exchange data now the reason SSH is secure is because there is encryption involved so whenever two machines are connected over ssh the data exchange happens with encryption so the information is encrypted and by encryption it means that the actual data is converted into some ciphertext which is not understandable by humans as well as the machines are not able to extract the actual information because there are some encryption algorithms used now a very common and a very famous example or an anlogy to explain this communication is like this suppose you have a friend and you want to send a box to your friend the box contains some very important documents and you do not want that this should be accessed by anybody else except your friend so you put a lock on the box and send it over to your friend now you have the key to the lock so your friend cannot open the lock once your friend receives the box he puts his own lock over the box so the box now has two locks he sends it back to you once you receive the box with two locks you can open your own lock because you have the key and now the box is left with only a single lock and you will send it again to your friend now your friend receives the box and he can now open the lock because he has the key to that lock and this is how the information and the data can be exchanged in a secure way now with this knowledge with this very basic knowledge of what SSH is and why is it used and how the data is secure when we use when we communicate over SSH Let us now learn how exactly SSH works Ok so now to establish SSL connection we need three things or three components the first one is the server or the remote machine that we will access from the local machine and then we need the client or the local machine and then we need an authentication mechanism so that the server can authenticate the client and vice versa now let us come to the first part that is the server or the remote machine that you want to access over ssh now to make any system a SSH server you need to have ssh running or that system must have the settings set up so that it can be connected remotely now this ssh server can be any system it can be a Windows system it can be a Linux system it can be a Mac or it can even be any Android or iOS system now in case the system is Mac you just need to allow remote connections on that system if it is Linux or Windows you can install openssh server and with this you will have the the system ready to be accessed over ssh and if it is Android or iOS again you will find some apps that you can run so that it becomes ssh server or it is ready to be connected remotely so this is the first thing and this is what we need that is we need a ssh server or a remote machine then we need a ssh client that will be our local system or local machine and again it can be a Mac Linux Windows or even Android or iOS systems now in case it is Linux or Mac you do not need to install or do any extra setup you can directly use your terminal on Mac or Linux as a ssh client if it is Windows then you can get some ssh client applications like Putty or if you have a GIT Bash command prompt installed you can also use that to connect over ssh and if it is Android or iOS then you will find some apps like Termius that can help you to connect over ssh now we have our client ready and now the third thing is the authentication mechanism now when you connect a remote system from your local system using ssh we have to authenticate this conection and there are two ways of this connection to be authenticated one is using the password the other one is using keys that is public and private keys so in very simple ways if you want to connect over ssh to remote system you will say ssh user@ip so this is a very simple syntax of the command now a real command will look something like this you will say ssh and you will give the user that you want to access the remote system as and at the IP of the system so when you run this command this are you want to access the remote system that is this system as the root user when you run this command you will be prompted to provide the password of that system or whatever password you have set and you will provide the password and once this is all the authentication is done then you will be able to access the remote system and then you can run your commands on the remote system so this is a very simple way now the other way is having the Keys that is public and private keys and let us discuss that in the next section now in case you want to have authentication created or authentication done using public private key what you can do is from your client machine you can run a command ssh-keygen so the command is so you run this command we also can give the type of authentication like rsa so when you run this command ssh-keygen it will ask you where exactly you want to store or what is a filename you want to give to your public and private keys if you want to give some a specific name you can provide that you can provide the location and name or if you can directly hit enter and it will take the default name and it will also then prompt you to provide some password for your private key in case you want to make your private key more secure that if anybody by chance gets your private key he should not be able to use it unless he provides a password then you can provide a password to it or if you do not want you can just hit enter on the command line and this will create two keys a public key and private key on your system now the public key you can send over to the server or to the remote machine that you want to access and you can just use commands like ssh copy to copy the key the public key or if your ssh server can be accessed from the browser with the UI for example in case of GitLab or GitHub that is a remote system the GitLab system or the GitHub system is a remote system and if you want to access it through ssh you can just open your account on GitLab or GitHub and go to the ssh section and then there will be a option to browse and upload your public key so you can also do it through browser if you have that option so in very simple terms you have to create these two keys using these commands and then send the public key over to the remote system now after you have set up these keys and you have also send the public key to the server after this whenever you try to connect over ssh using these commands or any way you try to connect to the remote system using ssh the authentication will happen using these keys so as you try to connect or you send the connection request to the server the server will send the Client a random message a random string and your client will Encrypt the message using its private key and send it back to the server the server will Decrypt it using its public key and if the matching is successful the connection will be established and now you can access the remote system or do any work there or Run any commands so this was all about SSH and how SSH works in very basic words now if you are somebody who understands better with stories I also have a story written on ssh I will provide the link in the description of this video and I will meet you in the next episode of School of Basics with a new topic thank you for watching
Info
Channel: Automation Step by Step
Views: 30,220
Rating: 4.9333334 out of 5
Keywords: ssh interview questions, ssh history, what is telnet, how ssh is better than telnet, why to use ssh, ssh for complete beginners, ssh step by step, ssh by raghav, how to use ssh, ssh explained, ssh tutorial for beginners, ssh from scratch, learn ssh, advantages of using ssh
Id: lRMAJwMQ0Vc
Channel Id: undefined
Length: 10min 43sec (643 seconds)
Published: Mon Jul 27 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.