طریقه استفاده از OpenSSH در لینوکس

openssh

What is OpenSSH?
OpenSSH is a suite based on SSH (Secure Shell) protocol providing a secure network for services like remote login or remote file transfer. OpenSSH is also known as OpenBSD Secure Shell and was initially developed as a part of OpenBSD operating system.


What are the features of OpenSSH?

  1. OpenSSH is freely available for everyone, their code encourages reusing and auditing of the code.
  2. OpenSSH has a secure tunnel to forward remote TCP ports through strong encryption (3DES, Blowfish, AES, Arcfour).
  3. An ad hoc SOCKS (Secure Sockets) proxy server can be created using OpenSSH.
  4. OpenSSH provides secure communication.

Difference between SSH and OpenSSH

SSH OpenSSH
  • SSH is a closed source cryptographic network protocol.
  • OpenSSH is a free open source protocol based on SSH.
  • SSH was first released in the year 1995 as SSH-1 protocol, trying to replace TELNET, rlogin, ftp and rsh protocols.

 

 

  • OpenSSH was released in the year 1999, for developers wanting a free software version, the original 1.2.12 release of SSH was released under open source license.
  • Some SSH commands are:
    Ssh-keygen, ssh-copy-id, ssh-add, ssh-agent, scp, sftp and sshd
  • Some commands are:
    ssh, ssh-keygen, ssh-agent, ssh-keyscan,  scp, sftp and sshd

Requirements

  1. Root access to your server
  2. Terminal (Linux)

How to enable OpenSSH on Servers:

In order to get SSH on the server, we need to run the OpenSSH package. For example, Apache is a package and the daemon is httpd. Similarly, OpenSSH is installed on the server and you use this via SSH. At afagh, OpenSSH is already installed and ready to use on all our Linux Hosting servers and Managed Servers and clients have a complete root access using it.

Although OpenSSH comes pre-installed on various versions of Linux for both the client side as well as server side and is incorporated into many commercial products. However, if you still wish to check if it’s installed then we can run the following commands.

Using OpenSSH on Linux:

To install OpenSSH on Linux, we use Ubuntu as an Operating System on standalone PC.
For Ubuntu/Debian:

Step 1: To install OpenSSH on client side and server side

Type the following command in the terminal and wait till the packages are downloaded and installed.

sudo apt-get install -y openssh-server openssh-client

Step 2: Check if the service is running

Once OpenSSH has been installed you will need to check if the service is running properly or not, run the following command.

service sshd status

Step 3: Configuration

Before editing the configuration file, it is important that you make a copy of the original file in case of any mistake you can reuse this and have the proper settings in place.

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original-copy

I added the original-copy suffix, so every time I see this file I know it is an original copy of the sshd_config file.

Step 4: Connecting to OpenSSH

  1. By default the service runs on TCP port 22, you can change the port as such: Port 13
  2. To have sshd allow public key-based login, modify the following line:
    PubkeyAuthentication yesIf the line is already present, then make sure it has not been commented.
  3. Restart your OpenSSH server so that the changes in the config file can take place.

    sudo /etc/init.d/ssh restart

  4. If you want to have your OpenSSH server display a nice login banner, then you can do so by modifying the contents of the issue.net file by

    Banner /etc/issue.net

نوشته های مشابه