An ad-free and cookie-free website.
Videos can also be accessed from our Full Stack Playlist 1 on YouTube.
Install SSH server with openssh server software on Linux (4:38)
Welcome. Today's question: How do you set up SSH on the server side in Linux? The easy way.
I'm Paul, and it's my mission to make difficult concepts easy.
Here we're starting a journey in Data Science, which is anything but easy, jumping into a topic, SSH (Secure Shell) that also isn't easy. So here we'll keep it simple and hop over to the server to make sure it will respond to SSH requests.
Then I'll summarize what's different between this, the easy way, and the hard way, which we'll cover in later tutorials.
Then in the next tutorial, we'll set up Secure Shell on the client side. Fair enough?
Okay, so let's connect to the local server by pointing to its IP address and logging in (plus clearing the screen).
I'm using a Windows client, and also on that client sits a program called PuTTY that allows me to create a window and communicate using the Secure Shell, or SSH protocol. (So my server already has the SSH server software running, or I wouldn't be able to log into it remotely, right ;)
We use commands all the time, and I'll explain each one later, but
for those new to Linux, I'll include a summary of commands by using
whatis. That way, if I go too fast,
you can catch up later.
The server has been up for over 2 weeks, yeah but how would we know
if the SSH server is running? Obviously it is here, but to verify,
we could use
ps to see running
This is the server version here, called sshd, the 'd' is for daemon, which is a type of program that runs in the background.
This can get confusing quickly, as demonstrated by a listing of SSH programs including the term 'ssh'. Here are the programs associated with the SSH client (at the top), and the sshd daemon (at the bottom). So if you don't have these, then you need to download programs associated with sshd, because some Linux distributions only include the client versions by default.
To get them, you'd type
install the program
openssh-server. You will need
superuser privileges to run
sudo at the start of the
line. Also, always precede a
sudo apt-get install with an
sudo apt-get update to make sure you
have the latest list of programs and their locations.)
And if this looks odd (the
#), I put
it all behind a pound (hash) sign, telling Linux to ignore the line
and not run it. (This is essentially a comment).
Open SSH is the most frequently used SSH program for Linux. It is packaged with other utilities, which we will cover later.
Now, assuming you've got it, you can do the following by typing the full path to stop it, start it and restart it, which you would do, for example, after making changes to configuration files. (Again, you may need superuser privileges to do this.)
(Again, I put it behind the
# so it
Speaking of configuration, let's head into the
nano text editor and jot down a few
points about the easy way, we're using here. (Here we are changing
directories and opening a new text file on one line.)
First, we're accepting the default configuration, which should offer adequate security for a local systems like here in my office in California.
Second, we only used the SSH login method, followed by how to install and maintain sshd.
What we will cover in the hard way, in the future, will be how to make this a whole lot more secure. Starting with fine-tuning the configuration files, especially when the server is accessible across the Internet.
We'll talk about using SSH keys that equate to over 600 random characters, making it more difficult for hackers to crack, plus changing ports, specifying users, limiting failed attempts, logging these attempts, displaying a warning page to would-be hackers, and another important concepts for communicating in the cloud, called tunneling.
So this was the easy version of SSH. We'll return to the topic to expand on security, which is a topic nobody seems to feel very confident about.
This is a picture of our in-development Data Science stack. You are welcome to join at any time.
Next we'll cover the SSH client, on Linux, macOS and Windows.
Have a nice day.
For updates to installation of later versions of software stay tuned to our YouTube Channel, Twitter @factorpad and email list for instructions.
A newly-updated free resource. Connect and refer a friend today.