Linux Tip | How To Use SSH Remote Login

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
greetings and salutations and thank you for clicking on the video today we're going to look at SSH the secure shell this is a very groovy program to know about and it is not Linux specific this works on any platform anywhere in the world and it allows you to remotely log into a computer on your own network or log into a computer somewhere out there on the Internet as long as you have the credentials to do so and the IP address of that machine you can get into it and SSH is a very powerful tool it is used by IT professionals everywhere there are folks who have jobs assists admins they get up in the morning they get themselves a cup of coffee they're still wearing their bathrobe they sit down in front of their computer and they log into the servers and computers that they maintain and this is how they do it so it is truly an awesome thing to use and I do apologize for not having done a video on it sooner I just haven't used it in a long time myself I'm going to actually put this in the playlist for my bash basic series that I completed a little while ago because you can use everything that I taught you in that series to get work done with SSH so we'll start talking here about getting it set up on your system pretty much every Linux distribution has the SSH client installed which means that you can log in to computers elsewhere but if you want to be able to log in to your own computer you are going to have to install and configure the SSH server so to get that in a boom - it's actually quite easy sudo apt install that I typed that right yos open SSH server that's the name of the package we're looking for I already have it installed on this machine so I'm not going to actually run this command but I wanted to show you what it looked like you can do it from your Software Center - you don't have to do it from the terminal it don't matter it's just a package install it how you like so when you install SSH it's going to take it a little while to get itself together it's going to generate a bunch of secure keys it's going to start the service you do not need to restart the machine SSH will immediately start broadcasting on port 22 if for some reason your firewall or your router whatever is hardware you have running on your network their blocks port 22 by default and some do because leaving port 22 open can be a security risk then you will have to configure the SSH server to use another port you will have to configure your firewall to allow port 22 or you will have to configure your router which usually has a hardware firewall in it to do that as well that is beyond the scope of this video for me to explain how to do that if you run into a situation where SSH doesn't work and you don't have access to port 22 there are a lot of great tutorials which are available online and they will take you through the process of verifying whether port 22 is available to you and how you can change the port and SSH so once it's all installed let's just assume that it's all working the way it ought to and you don't have to change nothing you don't really have to configure anything it's available it's ready to go so to log into a computer that is running an SSH server then you would just type in SSH and if you have an account on that machine and you're logging in from that account on the machine that you're logging in from if that makes sense then you don't have to specifically tell it the account you can just give it an IP address so in this case we're going to give it 192.168.0.1 and it asks for a password I have logged into this machine before so it did not stop and prompt me and asked me whether I really wanted to do this the first time that you log into a machine it will throw up a message and it'll say that it has to exchange the certificates and all that other stuff the the keys that make it a secure connection and so therefore it's going to verify that you want to do that type in yes and then it will ask for your password so I'm logged into this machine and I'm good to go here I can do anything on my Dell machine from the e machine that I'm sitting at that I could do if I was sitting at the Dell machine and working in a terminal so we can list the storage in there I can even get files off of here through the SSH protocol I can copy a file off that machine so let me show you how to do that real quick we're going to use the secure copy command to do that and the file that I want is test dot txt and I had that already put together before started the video to just make it easy so I'm going to secure copy test dot txt and I'm going to put it on the machine that I'm currently running on so to do that I'm going to have to put in its IP address so we're going to put it in to 192.168.0.1 oh I need to be on the machine that I'm copying to this one is 14 on my network and then colon and I need to tell it where to put it in the file system so I'm going to tell it to put it in my home folder and we'll just stick it on the desktop and give it a file name for it to copy to and in this case just use the same file name txt okay and if I have done that correctly then this should copy this over the network yes I want to continue I haven't logged into that other machine I have to type in the full yes and it asks for my password because now I got a log into the machine that I'm actually on and it did it okay I was not I had to log in the other direction so I'm glad that it did that so that you could see how that works so if that popped up you wouldn't get freaked out so if I come to this machine and we just make our terminal minimized you see that I now have that file there pretty cool huh so I can actually move data back and forth between machines using SSH it's not like a Samba server it's it just moves it back and forth as long as I have access to that account I can do that so once I'm done on this machine whatever I'm doing with it then I can log out okay I am now off that machine the connection is closed and we're done so if I want to log in to another machine as another user I can do that as long as the ssh server has what users are available to login listed so for instance if i wanted to allow cindy to log into her account then what I would have to do is I would have to add her to the list at the end there and then she would be able to log in so that is the basics of how that works but there is more to this way more to this that's nice that we can log in and work at a terminal when we can go in we can update the system we can check all the administrative tools we can find out what's going on with it see how many people are logged in how long it's been up and all that stuff but what if you want to run an application that requires a GUI you can and the way we do that is we're gonna go back to our same command here me hold on let me go ahead and clear the screen so we can do it up top here all right so we go back to our same command and I'm going to add an argument to it which is capital X make sure I get that typed incorrectly now the space thank you and it has to be a capital X and I'm going to log you back into that machine now I am logged into that computer and yeah I can use terminal applications H top for instance see what the machine is doing but I can also use applications that require X which is the display server and client that actually draws pictures on your screen so let's just open up a text editor on the other machine here it takes it a second to get that set up now you see that I have running on my screen pluma which is the text editor but it is running on the other machine how does this work the X Windows system is divided up into two separate applications there is the X server and the X client and on your local machine the X server if you have an X application which is what a graphical application is it tells the X server what needs to be drawn the X server sends that data to the X client and then the X client actually draws the picture you see on the screen so we can divide that up it doesn't have to be on the same local machine so in this case the X server on the Dell machine is telling the X client on this local machine the e machine what to draw through the network and so you can actually use X applications now the applications that you do use have to be relatively simple okay you can't use really sophisticated graphic intensive applications it will be very slow and dragging it might not even actually render at all so you know if you open up an application and you find that it's not rendering properly or getting errors that's why because it can't do like multi threads and things like that but for simple applications like for instance on the other machine I may want to log in and I want to use bleach bit all right I want to might want to clear out my folder of stuff remotely now I can use bleach bit and it is running on the other machine so just for fun here we'll type in Firefox and this is going to really be slow because it's a very big application we're actually going to try and do a web browser through SSH it works but it's really draggy and Google Chrome at least on my setup boy it doesn't work at all but I can open up Firefox so it's taken quite some time to actually display the page and all that stuff you can see what I'm talking about here about it being a bit dragging but you can do it you can actually log into so if I tell it to log into easy Linux you'll see how long it's going to take it actually draw easy Linux on the screen because we're using the X server split up here so it is taking its time but it works so there you go Firefox running on the other machine but displaying on my terminal now I showed you how to copy files and you had to put that in there but here's something really groovy that you can do so on this other machine I'm going to open up the file manager so now I have on the other machine the file manager up and running and for the moment let's hide the terminal because we don't really need to see that and let's go in here and I'm just going to grab a picture and now I'm going to drag that from here to this desktop there it is so we have copied files from the machine that we're working on and let's see if we can put a file back so I'm going to go back here I'm going to go to the desktop on my Dell machine and I'm going to drag this test document over here and might not be working that direction let's try that one more time here no it's not going to let me do that but I can get files off of that machine so that's pretty cool if you need to log into a machine and grab some files off of it there you go you can probably configure it to be bi-directional that's the first time that I've actually tried doing that right here on this video but that seems to work right out of the box and I didn't even configure that to do that so once we are done with our SSH session close up close up all our X applications and now we can just get out of here so exit I've noticed that when I use X applications that it seems to kind of hang up the screen a little bit you notice that it's not returning me to my local prompt that's no big deal just ctrl C and that breaks out of it and it gets me back to where I need to be on my local machine there's a lot more to this gang this is just the tip of the iceberg so pretty awesome ok one more thing I want to cover before I wrap up the video cuz I'm pretty sure that some of you guys out there going how do you know what machine to log into and how do you get those IP addresses because the way a lot of us do it these days we use DHCP in our little router and it just arbitrarily assigns an IP address to whatever device happens to come on the network and what you can do if you're going to be doing this a lot is you can go around and you can set up all your machines to use static IP addresses so that way the the IP address doesn't change on your local network it'll be there all the time but if you're lazy like me and you don't want to go around and do that then there is a way that you can find out what the machines are doing so in this top terminal here I'm going to run a command called ARP a and I'm going to type it correctly ARP dash a and this is going to give me a list of all the machines that I have already logged into on the network by IP address and unfortunately for whatever reason it does not display host names probably something I'd have to reconfigure but I only have three machines on this network so I can pretty much figure out which one it is or I can just try and log in and see which machine it is it'll tell me once I get logged in they're all set up for me to log into anyway if you've just turned on the system and now you don't you don't have anything in the ARP cache there then you can install a little program called ARP scan and what this will do is it will go out and see what machines are actually available on the network so I'm going to call this local net so I'm basically telling this hey go out and see what machines are available to me now oh I have to do it as route and now it lists everything that's on the network and so there you go this this will tell me the machines that are currently up and running now my DHCP seems to be assigning pretty much the same IP address to the same machine so it's been pretty reliable like this machine is 13 the laptop is 12 and the Dell machine or this machine's 14 the Dell machines 13 and the laptop is 12 whatever so as long as you don't restart the entire system it may change the order in that of course like I said if I want to then I could stop being lazy about this and I could actually set static IP addresses on all these machines but I've only got three machines gangue I can pretty much figure out if I log into one and it's not it then I can walk into the so I don't know maybe I'll set up static IP somewhere down the road when I get the time so that's how you would real quick way to figure out you know what machines are on the network and for your own machine you can just look and see what the IP address is so I'm going to run iif config and I'm going to type it correctly and now this is the local address for this machine right here right there so this is machine number 14 so you can figure that out and then you could of course you can't do that remotely you'd have to have somebody log into the machine so yeah probably a really good idea to go through the process of setting up static IP so you know where everything is all right gang that is our video about SSH and I hope that you found it quite useful we will be talking more about more useful Linux things as we roll along please be sure and check out easy Linux on the web check out freedom penguin comm check out easy Linux on Facebook and if you do give it a like thanks for watching
Info
Channel: Joe Collins
Views: 103,297
Rating: 4.866354 out of 5
Keywords: Linux, SSH, Tutroial, Computer
Id: lLyjnuWVqMk
Channel Id: undefined
Length: 19min 4sec (1144 seconds)
Published: Sat Apr 30 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.