• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Techgoeasy

Techgoeasy

Learn Oracle, PHP, HTML,CSS,Perl,UNIX shell scripts

  • Home
  • Oracle
    • Oracle database
    • Oracle Ebusiness Suite
    • Oracle weblogic
    • Oracle Performance Tuning
    • Oracle Hyperion
    • Oracle Cloud Tutorials
  • SQL
  • interview questions
  • Linux
  • PHP and HTML
  • Downloads
  • General
Home » Unix command and scripts » How to install SSH on Ubuntu

How to install SSH on Ubuntu

September 8, 2018 by techgoeasy Leave a Comment

SSH is nice tool to connect to the server. it encrypts all traffic to eliminate eavesdropping, connection hijacking, and other attacks. I will be giving the steps for installing that on Ubuntu OS

Step 1: First check if it is already running

ps -ef |grep -i SSH

Step 2:  Now install the SSH using the command

sudo apt-get install openssh-server -y

Here are some issue which you may get

a) I get the below error when  I fire the above command

unable to lock the administration directory (/var/lib/dpkg/) is another process using it” on the command line.

In order to resolve ,I did below steps

i) I first check if any apt session in progress

ps -ef|grep -i apt

Kill each of the process as they may hung processes

ii) Delete the lock file

sudo rm /var/lib/dpkg/lock
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock

This should the resolve the above issue

b) Second issue which i got  is for unable to connect to “us.archive.ubuntu.com” or “in.archive.ubuntu.com”

This is a mis-configuration on the DNS side on the server.

We can configure /etc/hosts with IP address and name to resolve it

sudo echo “91.189.91.23 us.archive.ubuntu.com” >> /etc/hosts
sudo echo “91.189.88.152 in.archive.ubuntu.com” >> /etc/hosts

If you get permission denied error ,then use nano or vi editor to make the changes

After these, my sudo apt-get command completed successfully and i can see the SSH process running

Step 3 : Now the step to change port(optional) and allow it it Firewall

i) We can change the port from default 22 to something like 14234

sudo nano /etc/ssh/sshd_config

or

sudo vi /etc/ssh/sshd_config

and change the port

ii) Now allow the port through firewall

sudo ufw allow 14234

or

sudo ufw allow 22

iii) Restart the ssh service

sudo service ssh restart

Now we are done with the configuration of SSH on ubuntu.

You can connect to the Ubuntu system using Putty tool and test it

Related Articles

How to generate ssh key pair on Unix using ssh-keygen

How to login to Linux with SSH private key from window client

41 Useful SSH Putty commands to help you manage the VPS /Dedicated Server

How to Setup ssh passwordless login using SSH keygen between two servers

PuTTY CONNECTION MANAGER (PuttyCM)

Filed Under: Unix command and scripts

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar



Subscribe to our mailing list

Enter your email address to subscribe to this blog and receive notifications of new posts by email

Recent Posts

  • How to generate sql monitor report in Oracle
  • How to find the long running (longops session) in Oracle
  • How to find concurrent request id from Sid or spid
  • how to check recycle bin in oracle: Purge, enable/disable
  • how to check fra size in oracle: Location, usage, change size

Copyright © 2023 : TechGoEasy

  • Hire me
  • Privacy Policy
  • Contact Us
  • New? Start Here
  • About Us