How to Install SSH in Ubuntu

Lab Steps

  1. First install SSHD (secure shell daemon) and client. Type in the following commands in a terminal session:
    sudo apt-get install openssh-server openssh-client
  2. Test your installation by connecting to your own server. Type in the following comand:
    ssh localhost
    ssh your-username@your-server-ip-address
  3. Basically you connect to your SSH server by knowing three things: 1) your domain name or ip address, 2) your username, and 3) your password.
  4. If you are using another remote Linux terminal to connect to your SSH server you will type the following terminal commands:
    ssh your-username
    example: ssh dan
    example: ssh 
  5. If you are using a program like PuTTY in Windows to connect to your SSH server you will need to fill in your domain name or ip address and click “Open”, after which you will be prompted for your username and password.
  6. The terminal commands to start, stop and restart your sshd server are:
    sudo /etc/init.d/ssh start
    sudo /etc/init.d/ssh stop
    sudo /etc/init.d/ssh restart


If you are l having problems connecting to your SSH server from another remote computer it may be a firewall issue. By default SSH makes connections on port 22, so you will have to make sure port 22 is open on your Linux computer, and if you are connecting from another network that port forwarding is enabled on your local router/firewall device on port 22 as well.

Author: Dan

Dan teaches computer networking and security classes at Central Oregon Community College.

Leave a Reply

Your email address will not be published.