Connecting Linux over the network using SSH
If you are going to connect a Linux system over the network, you most likely to use SSH. SSH stand for Secure Shell. SSH is a network protocol, its primary purpose is to allow you to connect a remote machines over a network in a secure way. In the past, you would use Telnet, SSH has replaced Telnet as its more secure counterpart. Telnet is practically obsolete today, but you may encounter it if you have to connect to a legacy system.
In order to connect to a Linux machine over the network:
- For Windows client - the most popular SSH client and terminal emulator is a programm called PuTTY.
- For Linux client - open the terminal and use
- For Mac client - open the terminal and use
For Windows client
To get PuTTY, you can open up a web browser and download the putty.exe from here.
To connect to the Linux machine using the SSH connection protocol, lanch Putty.
Enter the host name or IP address into the Host Name (or IP address) box. If no port was given to you, leave it at the default value 22.
To enter your username, click the Data (Below the Connection) in the left pane. Enter your username into the Auto-login username field. If you skip this step you will be prompted for your username when you connect to the server.
To save your session, enter a name in the Saved Sessions box and click Save. This allows you to speed up this process by simply double clicking on your saved session to connect to the Linux machine.
When you click Open a connection will be made. The first time you connect to a particular server, PuTTY will ask to cache that server's host key. You will not be prompted again on subsequent connections. To add the server's SSH host key to PuTTY's cache, click Yes when prompted.
Once you are successfully logged in, you will see something like this:
For Linux/Mac client
The built-in SSH client on Linux/Mac is a command line programme. It can be run with the Terminal that comes with the operating system. For Mac, it is located in the Applications/Utilities folder. For Ubuntu Linux, open the Dashboard and search Terminal.
Once the terminal is started, you can use the
ssh command to initiate a connection. Commands are case sensitive, so be sure to use lower case SSH. For example, if your username on your Linux/Mac is robin and your username on linuxserver is also robin, you can omit
robin@ and simply type
ssh linuxserver. The following 3 are the same.
ssh linuxserver ssh robin@linuxserver ssh -p 22 robin@linuxserver
The first time you connect to a particular server, you will be asked to verify that server's host key. You will not be prompted again on subsequent connections. When you are asked Are you sure you want to continue connecting (yes/no)? type
yes and press Enter. Once you have established a connection, you will be prompted for your password.
ssh linuxserver The authenticity of host 'linuxserver (220.127.116.11)' can't be established. RSA key fingerprint is 53:b4:ad:c8:51:17:99:4b:c9:08:ac:c1:b6:05:71:9b. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'linuxserver' (RSA) to the list of known hosts. robin@linuxserver's password: Last login: Sat Feb 12 09:09:09 2015 from 18.104.22.168 [robin@linuxserver ~] $
To exit, type
[robin@linuxserver ~] $ exit logout Connection to linuxserver closed.
If you want to connect to the remote system using a different user name, you type in:
If you are in work, you might connect to a linux server that ends in .domain.com
- Dependency injection
- Directives and Pipes
- Data binding
- HTTP Get vs. Post
- Node.js is everywhere
- MongoDB root user
- Prefer Async Script Loading
- Components, Bootstrap and DOM
- What is HEAD in git?
- Show the changes in Git.
- What is AngularJS 2?
- Confidence Interval for a Population Mean
- Accuracy vs. Precision
- Sampling Distribution
- Working with the Normal Distribution
- Standardized score - Z score
- Evaluating the Normal Distribution
- What is Nodejs? Advantages and disadvantage?
- How do I debug Nodejs applications?
- Sync directory search using fs.readdirSync