- How to SSH Linux, How to connect to SSH Terminal
- What is SSH?
- SSH Work Methodology
- Enabling an SSH Connection
- OpenSSH
- Installation of Open SSH client
- Install the OpenSSH client manually:
- Install an OpenSSH Server
- What is KiTTY?
- Tabs Top Level Organization
- Configuring kitty for SSH
- Solar-PuTTy
- Installation of Solar-PuTTy
- Creating new Sessions
- Solar-PuTTy’s Features
- Bitvise SSH Client
- Installing Bitvise SSH Server
- Unattended installation
- Unattended configuration
- Bitvise SSH Client
- Conclusion
- How to Connect to a Linux Server Using Secure Shell (SSH)
- Remote Login
- Tools
- Login Using a Password
- Login From Linux or MacOS X
- Login From Windows
- Password-less Login
- Generate an SSH Keypair on MacOS X and Linux
- Copy a Public Key to a Server
- Securing a Private Key
- Login With a Keypair on Linux or MacOS X
- Generate an SSH Keypair on Windows
- Login using Keypair using PuTTY
- Copying Files Using Secure Copy
- Copying Files From Linux or MacOS X Using SCP
- Copying Files From Windows Using WinSCP
- Running a Command Remotely On Server
- Conclusion
How to SSH Linux, How to connect to SSH Terminal
How to SSH to a Linux server? Well in this tutorial we will show all the possible ways to connect to a server using SSH clients.
List of content you will read in this article:
As you might already know, the majority of servers on the internet are running the Linux operating system. While having an on-site server is the most secure way to manage it, in the majority of cases, such a system is either impossible or not optimal for the user. That is why most opt for either having their own servers installed within a datacenter or rent out a ready-made one in a colocation facility.
In such cases, in-person server management can prove to be difficult, making remote server access a necessity. To connect to a Linux server remotely and manage it over the internet you will have to use SSH.
What is SSH?
SSH (Secure Shell) is a network protocol used to send and receive data and other information over the internet without the fear of eavesdropping and getting important data stolen. Once you have developed a secure SSH connection, you are endowed with the permission to manipulate the server by merely typing the commands on your local computer.
When someone wants to manage the computer remotely in a secure way, the person uses SSH commands to get the work done. This protocol is especially loved by system and network administrators for the control and agility it provides to the users. Here are some of the things you can do with it:
- Secure system administration
- File transfer
- Communication across the Internet
- Send and receive valuable information over other untrusted networks
- Encrypt Identities and Passwords
SSH Work Methodology
SSH requires two basic components to complete the process of establishing a connection and allow you to remotely control the server. These components are:
- An SSH client
- Corresponding server-side component
The client is an application which you need to install on your computer to connect to the remote server or other computers within the local network. The remote host information is the key factor the client uses to establish the connection. When these credentials are deemed verified, the client becomes able to encrypt the connection.
The other component, on the server-side, is the SSH daemon that is on a continuous watch to listen to the specific TCP/IP port for any query or possible client connection requests. Once the client has initiated the connection, the SSH daemon will reply and respond as per the software protocol. If the credentials that the client has provided are correct, it will create a favorable environment for them to interact with each other.
Version 2 is the default SSH protocol version for SSH communication between a client and an SSH server.
Enabling an SSH Connection
As per the requirement of the connection, there are two parties involved in an SSH connection; one is the client and the other is the server. You have to make sure that the remote machine and local system both have SSH connections installed and enabled on them.
The most famous open-source tool for SSH is OpenSSH. This tool is comparatively easy-to-use and only requires terminal access to the server to which you are trying to connect.
OpenSSH
OpenSSH is one implementation of the SSH protocol on the server and client that is completely open-source.
Installation of Open SSH client
Most of the time, Linux-based distributions already have an SSH client installed on them, however, if you are using Ubuntu, be informed that the SSH server is not installed on it by default.
For Windows-based machines, install PuTTy or any other SSH client software to gain access to the server. Do also keep in mind that you will have to enable OpenSSH on your Windows device.
The process starts with the following steps:
Step 1: Load SSH terminal
Step 2: Press CTRL+ ALT + T at the same time
Step 3: Type in ssh and press Enter
If you have already installed the client on your system, the output will look something like this:
Install the OpenSSH client manually:
Type in the following command:
sudo apt-get install openssh-client
Then, type the superuser password and press Enter to complete the installation.
Install an OpenSSH Server
The installation of the OpenSSH server will require the following steps.
Step 1: Open terminal on the server machine
Step 2: Press CTRL + ALT + T
Step 3: Type ssh localhost and press Enter
If the system does not have an SSH server installation, you will see the following text:
If you see this message, you will have to manually install the SSH server.
Run this command to do so:
sudo apt-get install openssh-server ii.
Now, type in the superuser password. This will install the support file and you will be able to check the status by this command:
sudo service ssh status
What is KiTTY?
The fork form version 0.71 of PuTTY is known as KiTTY. This is undoubtedly the best telnet / SSH client in the world. KiTTY was originally designed for the Microsoft Windows platform and has all the features and add-ons from the original software.
Note that SSH and Telnet is not the same.
Pre-built binaries of KiTTY can be used and are available for macOS and Linux. Use any one of your favorite package managers to install the KiTTY package. It is available for the following:
- macOS with Homebrew (Cask)
- macOS and Linux with Nix
- Ubuntu
- Debian
- openSUSE
- Arch Linux
- Gentoo
- Fedora
- Void Linux
- Solus
Possibilities are endless and it is specifically designed for power keyboard users. The people who want to control all the work by using the keyboard love the keyboard shortcuts Kitty offers them. However, if you want to use a mouse, you can also do so to achieve your tasks.
Codes in KiTTY are fabricated to be very simple, hackable, and modular. The codes are specifically written in C (for performance-sensitive parts) and Python (for easy hackability of the UI). The dependence is not inclined on large and complex UI toolkit. The most famous and top-rated feature of KiTTY is that it can be easily extensible. You can add new features without any significant effort.
Tabs Top Level Organization
You can run multiple programs and organize them by manipulating various windows. The top-level organization of windows is Tab. There are several windows in each tab. You get the liberty to arrange these windows in various tabs.
Here you can see the keyboard controls for managing windows.
Configuring kitty for SSH
The high customizability allows you to use keyboard shortcuts to perform almost any operation. You can also create your very own keyboard shortcuts. If you want to configure KiTTY with SSH, you must do the following.
Step 1: Type kitty.conf
Step 2: Enter the following command:
Step 3: Begin the configuration by typing the following command:
kitty -o allow_remote_control=yes -o enabled_layouts=tall
Step 4: Open a new kitty window and type the following:
kitty @ launch —title Output —keep-focus cat
You will see a new window that will be running the cat program.
Step 5: To check the accessibility, type the following command:
kitty @ send-text —match cmdline:cat Hello, World
Solar-PuTTy
If you want to connect to your routers, switches, and server over SSH you can find great benefits within this protocol. The UNIX shell environment can be perfectly used by a Windows user through Solar-PuTTy. This powerful software is open-source, and it is free for anyone to download and use.
Installation of Solar-PuTTy
Solar-PuTTy is available from SolarWind’s official site. You don’t need to make any special arrangements and go through the tiring installation process to use this software for your SSH communications. Simply download the software from the website and run it on your system. After running the file, you are good to go. The staggering feature is that the file size is only 1MB.
Creating new Sessions
Once you have installed the software, it is time to open and look for the pages that create your session on the system. To create a new session you can manually enter your log-in details.
The most mesmerizing feature of this software is that you don’t have to configure all the devices here. You can simply import and use all the SSH configurations from the any previous SSH software if you have used any.
Solar-PuTTy’s Features
Here are some of the most attractive features Solar-PuTTY offers:
- Save remote sessions
- Supports tabbing
- Supports Login Scripts
- Storage of Login Credentials
- Dedicated Search bar
- Integration with Windows
Bitvise SSH Client
This software gives the users the power to connect to SFTP servers by utilizing a regular FTP client. You can achieve the required client requirements by simply connecting to the SFTP server by utilizing your SSH.
The people using solar-PuTTy when install the Bitvise on their system they can explain this software in a far better way.
There is only one catch for Bitvise; it is not meant for beginners in the field of SSH. It is much more difficult to use Bitvise than it is to use PuTTY. All the environmental features are fused to create a unique and powerful working environment for the users at all levels. It has a simple GUI that comes in a well-organized layout with various categories embedded within it.
Installing Bitvise SSH Server
First of all, download the installer from the Bitvise website and run it.
Unattended installation
You can also install the Bitvise SSH server in unattended mode.
For supported command-line parameters type the following:
For a fresh machine, to start it immediately, type:
BvSshServer-Inst.exe -defaultInstance -activationCode=0123. 6789
Unattended configuration
For an automated configuration type the following command:
BssCfg popups show -never -default
Run BssCfg without parameters for help.
Bitvise SSH Client
Install the SSH client from this link and start using your Bitvise right away.
Conclusion
There are advantages and disadvantages to using any of the SSH software mentioned in this article. We hope that by reading this, you are able to make a better-informed decision on which one suits you better. If you have any questions or suggestions, please leave them in the comment section below.
Источник
How to Connect to a Linux Server Using Secure Shell (SSH)
Need Hosting? Try ours, it’s fast, reliable and feature loaded with support you can depend on.
Remote Login
There are times when we have access to physical servers and we can login directly from the server console in front of the server, or at least next to the server via KVM console. But, most of the time we don’t have access to the physical server so that we have to login remotely to the server. In this tutorial we’ll learn how to login remotely to a Linux Server using Secure Shell (SSH). Of course, you can also use this tutorial as guide to login to *NIX family operating systems as long as they have SSH installed.
Tools
- On Linux you can always use Terminal application. This application should be available no matter what desktop environment that you use.
- MacOS X also has Terminal.app installed by default. You can also use iTerm2 as Terminal alternative on Mac.
- Windows does not have an SSH client or server included. You can use PuTTY to do remote SSH logins from Windows. You can download PuTTY for free. You can download the individual program or PuTTY installer that not only installs PuTTY but also additional programs like puttygen.
Login Using a Password
The most simple way to login to Linux Server is using a password as an authentication mechanism. In this section we’ll learn how to login to Linux server using a username and password pair.
Login From Linux or MacOS X
Linux, MacOS X and most UNIX variants have SSH installed by default, you don’t need to install any additional packages unless you only install the minimalist package that does not install openssh package. In this tutorial I assume that you already have ssh client installed.
To login to a Linux server using ssh you can use the command below :
Another way to login is using the -l option for username :
In case you need to access a server that is not using SSH default port (22), you can specify an SSH server port number using -p option. In the example below the SSH port is 2222.
In the example below we try to login to server 128.199.138.34 using username root .
The warning above is shown if you are connecting to the server for the first time. The SSH client will check the authenticity of the server by checking the SSH fingerprinting. Since this is first time connection, SSH does not have any record of this server fingerprint and wil ask you whether you want to trust this server or not. You can type yes on the question above and input your password.
If you have logged into this server before and you get this message again there are several possibilities that could happen :
- Your server is reinstalled and of course the SSH fingerprint changed.
- Your server compromized or someone act as man in the middle (MITM), so instead of connecting to the real server you are connecting to the MITM machine.
- Wrong change on DNS records entry so you are connecting to the wrong server.
Login From Windows
Now we’ll learn how to login to a Linux Server from a Windows Machine using PuTTY. I assume that you already download PuTTY.
- Input the server address, this can be a hostname or IP Address
If you login to this server for the first time you will get a security alert regarding server fingerprint. If you are sure that you’re connecting to the right server you can click Yes.
You have to input your username and password to login.
Password-less Login
In the section above, we already learned how to login using username and password pair. In this section we’ll learn how to login without password, we’ll use keypair instead.
First thing that we have to do is creating keypair. We’ll get a private and public key. You have to keep your private key secure while you can use the public key on the server. You can use the same private & public key on multiple servers.
Generate an SSH Keypair on MacOS X and Linux
To generate keypair on MacOS X and Linux, you can use comand below :
-C options will allow you to give comment for this keypair, this is -f option allow you to specify filename for the keypair. This process will create two files, since we use filename keyfile above, ssh-keygen will create keyfile and keyfile.pub . You might already guess the one with the .pub extension is public key and the one without extension is your private key.
Copy a Public Key to a Server
To copy public key to server, we can use scp program. We’ll learn a little bit more about using scp on the section below. You can run command below to copy keyfile.pub that you just generated to a server:
(tidle) symbol above means home. So this command will copy the public key to the user home directory.
After copying the file you need to login to the server and run command below on the server:
Securing a Private Key
I recommend moving your private key to
/.ssh on your computer. After that, change the file permission to 400 . This will make the file only readable by you, group and other users cannot read this file.
Login With a Keypair on Linux or MacOS X
Now the keypair is ready to be used to login to the server. You can use the ssh command below :
The -i option will tell SSH which private key to use.
Generate an SSH Keypair on Windows
- From the same site where you download putty, you can download puttygen. Open this application.
- To Generate a new keypair you can click Generate. Hover your mouse cursor around the blank space to give randomness to the generator.
- Key Created. To save the public key from the pair you can click Save public key button.
- Save as keyfile.pub. You can copy this file to the server.
- To save the private key you can click Save private key button. The warning from puttygen is that your key is not protected. We can ignore this warning.
- Save the private file as keyfile.ppk. This is the private key format used by PuTTY and not the .pem format that usually used in Linux / MacOS X.
- To export the private key to .pem format, you can choose menu Conversion ->Export OpenSSH Key
- Save the key as keyfile.pem
Login using Keypair using PuTTY
- Make sure that you have already copied your public key to
/.ssh/authorized_keys on the server
- You only need to input username. and Voila! No need to input the password but you can login to the server.
Copying Files Using Secure Copy
Copying Files From Linux or MacOS X Using SCP
In this section we’ll learn how to copy files and or folders to a Linux server and vice versa. Linux and MacOS X also have scp program installed by default so you don’t have to install additional program.
To copy a single file from our computer to a server, we can run :
To copy a folder and it’s contents including other folders you can use option -r (recursive). Below is sample of the command to copy folder data to server.
Copying Files From Windows Using WinSCP
You can copy files and/or folders from a Windows client to Linux Servers and vice versa using WinSCP. You can choose between portable executable or installable WinSCP.
- Open WinSCP. Choose SCP on File Protocol. Input Hostname, username and Password
- This is host fingerprint verification. You will get this message when you are connecting to the server for the first time. Click Yes
- You are connected to the server via SCP. The pane on the left is your local computer. The pane on the right is your folder on server.
Running a Command Remotely On Server
We can also run one off commands from our computer to the server. We can use -C option on ssh. You can only use this option with SSH client on Linux or MacOS X. PuTTY, even if you run it from the commmand prompt does not have such option. For example. to check process on server, instead of logging in and run ps , you can run the command below from your computer :
Conclusion
In this tutorial we’ve learn how to connect via SSH from Windows, Linux and MacOS X machine. We also learned how to do password-less login and run remote commands on the server from the computer.
Источник