Connecting to Linux
The course is part of this learning path
In this course, you will learn how to install a Linux system and connect to it, whether that be on Mac or Windows. You'll also learn how to install Linux from scratch. This course is part of the Linux Administration Bootcamp learning path, designed to get you up and running with Linux.
- Understand what a Linux distribution is, what the most common Linux distributions are, and how to choose the right one for you
- Learn how to install VirtualBox on Windows and Mac
- Learn how to install Linux using an image for VirtualBox
- Understand common issues that may arise with VirtualBox and how to deal with them
- Learn how to install CentOS from scratch
- Learn how to connect to a Linux system
- Anyone with little to no knowledge of Linux who wants to learn more about the operating system
- Professionals who want to learn about Linux to enhance their career prospects
This is a beginner-level course so there are no prerequisites, but an interest in Linux and programming knowledge in general would be beneficial.
The external resources for this course can be found here:
In this lesson you're going to learn how to log into a Linux system, and we'll talk a little bit about SSH, what that is and what SSH clients you need to use. If you have Linux installed on hardware that you have physical access to, or you have Linux installed in virtual hardware like a virtual machine running in virtual box, then you can connect directly to the Linux server.
In this example, we'll be looking at Linux running in a virtual machine. In virtual box you can highlight your Linux virtual machine and click the green button to start it up. We'll give it a few seconds here to boot. Each Linux login screen will be a little different. In this case, you're given a list of users to choose from, and when you click on that user, you can enter in the password for that user and click the login button.
I'm going to select Jason, type my password. I could either hit enter here or click on the login button. That's all there is to it. Just enter your username and password. In this example you're given a graphical user interface, the Linux desktop. In order to interact with the command line, you need to start the terminal emulator application.
In CentOS, this is located in the applications and then systems tools menu. There you see terminal, just click on it, and the next lesson will start interacting with the command line. For now, you just need to know where the terminal application is so you can start it. And to exit it, you simply type exit. To log out of CentOS, go to the system menu and log out.
On some Linux systems, you'll be prompted for a username. In this case, you have to type in your username. I'm going to log in as Jason. So I'll type Jason and I can either hit log in or hit the enter button, then I'll type in my password.
Let's see what it's like to log into an Ubuntu Linux system. We'll highlight the virtual machine, and instead of clicking the green arrow this time, we can right click and click start. Sometimes these are configured to auto log in, so you may not even have to enter username and password in. You'll just be given the desktop. In this case, you see a menu again with a list of users that you can select and then enter the password for that user. Hit enter to log in. I'm going to select the virtual box images.com user, and that username is actually admin user, and the password is admin user.
What is displayed in the menu is the description of the account. You can see that the Ubuntu desktop is different than CentOS. Again, each Linux distribution is gonna look slightly different and function slightly differently. I'm gonna exit out of the web browser here. You see a list of applications on the left-hand side of your screen. You can click on one of those to start it. If you don't find what you're looking for, you can click on the button in the top left and type in a search term. This case we're looking for the terminal application, so type in terminal and click on the terminal. And there we are at the command line And again, to exit the terminal application just type in the word exit.
In this desktop environment to log out or shut down, go to the top right hand corner and click the gear icon. I'm going to choose shut down, and when prompted, I'll click on shut down again. Sometimes you'll be presented with a text prompt to log in instead of a graphical user interface. Again, just type in your username and password. If you installed a server distribution instead of a desktop distribution, this is the type of login prompt that you would expect to see.
Again, to exit just type the word exit. Now log in as the admin user with the password of admin user. If you're going to connect to a Linux system over the network, more than likely you're going to use SSH. SSH stands for secure shell. SSH is a network protocol. Its primary purpose is to allow you to connect from one system to another system securely over a network.
In the past, you would use Telnet. SSH has replaced Telnet as it's more secure counterpart. Telnet is practically obsolete today but you may encounter it if you have to connect to a legacy system. We've already touched on terminal emulators a couple of times in this course already. In order to connect to Linux over the network we're going to need a terminal emulator that also acts as an SSH client.
For windows, the most popular SSH client in terminal emulator is a program called PuTTY. To get PuTTY, you can open up a web browser and type in P-U-T-T-Y. The result in Google is the download page and you only need PuTTY.exe at this point. I'm going to save the file. Now I'm going to open the file and run the program. In the host name or IP address box, I'm going to type in the network name of my Linux server. In this example, I'm using LINUX SVR.
Whoever created your account on the Linux server will be able to give you the details of either the host name or the IP address to use. This could be a server at work. It could be a shared host account. So maybe your SSH meant into your blue host.com or hostgator.com SSH count. Leave the default port at 22 unless you were specifically given another port to use. Click open to start the connection.
The first time you connect to a server you'll get a security alert, and you can simply just click yes on this. This will only happen the first time you log into a server. Now you can enter your username and password to log in. Type exit when you're done. PuTTY has many features and options. One of the things you can do is specify your username in PuTTY before you try to connect.
On the right hand side click on data, and then fill in the auto log in field. I'm going to save this as a session so that I can quickly log into the server again in the feature. I'll give it a name and click the save button. And then when I double click it, it will start a connection to that server. You'll see that PuTTY has already provided the Linux server, our username, and now all we have to do is enter in our password.
I'm going to highlight my saved session. Click load and change the font. Go to the left-hand side, click on appearance under window and then I'll change the font. Make it nice and large so we can see. You may have been given a IP address for your server. So if you don't have a name but an IP, you can use that as well. Again, the first time you log into a server or a particular IP address, it will ask you to confirm the post key. Just click yes. Again, PuTTY knows our username because we've specified it and now we simply enter in our password.
In order to connect to a Linux system from Mac, you need to start the terminal application. This is located and their application's folder and there's a sub folder and they're called utilities. You'll find terminal.app and that directory. Once the terminal application has started, you can use the SSH command to initiate a connection Commands are case sensitive, so be sure to use lower case ssh.
In this example, my username on my Mac desktop is Jason, and on the Linux server it is also Jason. So I'm just going to type ssh Linux server. Again, just like in Windows, you'll be prompted about the host key, and you only have to accept this the first time you connect. So I'll type in yes, and then I'll be connected to the Linux host To exit type exit.
If you want to or our need to connect to the remote system using a different username, you type in ssh space that username, the @ symbol, which is shift two, and the name of the Linux server. In this case, I'm going to use admin user and admin user is the password. Now we are logged into the Linux system and I'll type exit to get back.
If you are using Linux at work, you might connect to a server that ends in .yourcompanyname.com. Again, just use the host name or IP address that you were given to use. You'll see that connecting to an IP address works as well.
To recap, if you have physical access to a Linux system or if that Linux system is running in a virtual machine as in virtual box, then you can log into it directly. Sometimes you'll be presented with a graphical interface to log into, sometimes it'll be just a textual prompt. If you're going to log into a Linux system over the network, you are going to use SSH. For Windows users. I recommend using PuTTY as your SSH client For Mac users use the built-in terminal application and the command line SSH client.
Jason is the founder of the Linux Training Academy as well as the author of "Linux for Beginners" and "Command Line Kung Fu." He has over 20 years of professional Linux experience, having worked for industry leaders such as Hewlett-Packard, Xerox, UPS, FireEye, and Amazon.com. Nothing gives him more satisfaction than knowing he has helped thousands of IT professionals level up their careers through his many books and courses.