02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

How to SSH with a non standard port

How to SSH with a non standard port. We will see how this is done both on windows and mac.

Video Transcript

00:00All right, so let's start with our Windows users
00:02and MacEans don't run away.
00:04It's only gonna take three seconds.
00:06So I'm gonna go into our PuTTY on Windows
00:10and I'm just gonna load in our profile
00:12that we created earlier
00:14and I'm gonna go to the port itself
00:16and I'm gonna change the port to our new port, which is 1282.
00:19I'm gonna save our change.
00:21That way we'll always go to port 1282.
00:24I'm gonna click on to open it and see that we're working.
00:26And now because we changed our port,
00:29it's not recognizing that computer telling us
00:31that this is a new system for us.
00:33So that's fine.
00:34I'm gonna say that we trusted.
00:35This is a computer that we know I'm gonna click on okay.
00:38And there we go and now we're logged in
00:39and that's all we have to do.
00:41We only have to change the port on Windows
00:43and we are happy.
00:44All right, Windows users don't run away
00:46because I want you to see how to do it on a Mac
00:49because you might wanna create these type of logins
00:52even from one system to another.
00:54If you have two different hosts
00:56and you want one host from one host
00:58to be able to log into the next host,
01:00for example, you wanna protect your server even more.
01:03You might have a server that controls all other servers
01:06and the only way to access that server
01:08is through that server.
01:09The way you would do that is you would have to have,
01:12you would have to have basically,
01:15well not have to have anything
01:16but you would wanna know what we're gonna do
01:17in the next video.
01:18Obviously this is a very advanced thing
01:19for you Windowsian, Windowsians
01:23but for your Mac users, you definitely wanna do this.
01:25Let's jump in Mac and Windows users.
01:31I'm gonna go into the terminal itself.
01:33I'm gonna exit it.
01:35First step, I'm just gonna clear things up here
01:37and remember when we created our SSH connection,
01:41we just said the demo and we also set our IP address.
01:44Before that, what I wanna do is I wanna add the IP command
01:48which is the minus P space
01:50and I'm gonna say what is our new IP address
01:53which is 1282 space.
01:55Literally all I had to do is set the command SSH,
02:00set the port with minus P
02:02and then set the port number, in our case it's 1282
02:05and then log in and that's all we had to do
02:08and now because we still have that key,
02:10it's gonna automatically log us into the system
02:12without any problem.
02:13Now I wanna show you also one more thing
02:15so I'm gonna log out here of this user
02:17and I'm gonna clear that screen here for a second.
02:20I want you to go back into your SSH folder.
02:22If you're not in there already,
02:23just type cd strudel slash dot SSH
02:27and go right in there, be inside of the SSH folder.
02:30What I wanna do with you is I wanna create
02:31a new configuration file
02:34that will help us log into our server more quickly.
02:37So let's see how we could do this.
02:39So one is what we're gonna do is we're gonna go inside
02:42and I'm gonna use V for that
02:44and I'm gonna open up V
02:46and create a file called config, all right?
02:51Once you're in V, I'm gonna just right away
02:54move into the A so I could insert
02:56and I'm gonna type inside your list of our hosts
02:59and I'm gonna type your host space upper case
03:03for the H host and I'm gonna give it a name.
03:06This could be any name for our case or for example,
03:08this is gonna be, let's give it a name of geek demo, right?
03:14So our host is gonna be geek demo.
03:17Our IP address is gonna be our host name.
03:20So I'm gonna type your host name
03:22and I'm gonna type inside my IP address
03:24and my IP address in my case is 69, 28, 95, 95.
03:30Next I'm gonna go and I'm just gonna put here a little tab
03:33and underneath there, I'm gonna set a user
03:35and I'm gonna set that user to be demo
03:38and I'm gonna go for my port, port
03:42and I'm gonna set that port auto to our port
03:44that we just configured which was 1282, all right?
03:48I'm gonna press escape here
03:49and literally all I said was the host
03:51which is any name that I wanted to.
03:53The host name is the actual IP address
03:55and then underneath that I set also a user name.
03:58You know, I just clicked on a tab,
04:00clicked on my user name, set it to be demo,
04:02set my port which is our new port which is port 1282
04:06and all that's left for me to do is click on Shift ZZ
04:09to save it and I could get out of my configuration
04:12and now when I'm doing my SSH,
04:14remember what we called it, we called it geek demo,
04:16I could type SSH geek demo.
04:21And what will happen is gonna check our config file
04:24and log me right in.
04:25So if you wanna make it more simple,
04:28it's kind of fun, it's not mandatory
04:30but if you don't like typing so much,
04:32you could give yourself nicknames
04:34for the different configurations
04:35and you could just log in by just typing
04:37whatever that configuration is
04:39or you could just type SSH geek and you'll log in.
04:42So for example, if I'm gonna create one
04:43from my website zero to geek, I might create it,
04:45I might really call it SSH geek
04:47and don't worry about it, this is completely private,
04:49it doesn't really matter if anyone knows that that's the name
04:51and what's nice about it also that it's less visible
04:54so when people look at stuff,
04:55they don't see your ports and whatever
04:57when you're searching.
04:58Now one last thing before we're done
04:59and let me just exit this,
05:00always make sure that the new files
05:02that you're creating specifically now your config file
05:05is in the access level that you want it to be.
05:08So what I wanna do is I wanna,
05:09before we wrap up this video,
05:11I wanna go to my ch mode
05:13and I wanna tell this new config file
05:16what I want your security to be
05:17and we do ch mode 600, why?
05:19Because it's not an executable,
05:21it's a readable, writable file but it's not executable,
05:23even I can't execute it,
05:25we don't want any script,
05:26any malicious script to be inside there.
05:28So we're basically setting it to say
05:29you could read and write this,
05:31I could read and write this,
05:32no one else but me could
05:33and we're gonna set that config file
05:35and there we go, that's all we have to do
05:36to protect our file even further
05:38and now our configurations is so secure
05:41because only I could log in, only this user
05:45and only if he has the keys.
05:47So a hacker, theoretically,
05:49unless there's a major bug, a major flaw in SSH,
05:53which the only way you could prevent that really
05:55is from making sure that you're always updating
05:56to the latest version,
05:58keeping up your systems,
06:00keeping up with your system that it's up to date,
06:02which is very important.
06:04So that's it really, that's about security,
06:06about what things you could do
06:07and change in your configurations of your SSD.
06:11We're not done with security,
06:12we'll talk about another few security related things
06:15right away, so let's start our next lesson.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!