Ubuntu Linux OpenSSH Server installation and configuration

Q. I have just installed Ubuntu 6.06 and I would like to allow remote login to my system from home via ssh. How do I install and configure SSH server?

ADVERTISEMENTS

A. OpenSSH is a FREE version of the SSH connectivity tools that technical users of the Internet rely on. Users of telnet, rlogin, and ftp may not realize that their password is transmitted across the Internet unencrypted, but it is. OpenSSH encrypts all traffic (including passwords) to effectively eliminate eavesdropping, connection hijacking, and other attacks. Additionally, OpenSSH provides secure tunneling capabilities and several authentication methods, and supports all SSH protocol versions.

Ubuntu SSHD Installation

Type the following two command to install both ssh client and server:
# sudo apt-get install openssh-server openssh-client

SSHD Configuration

To be frank your server is ready by default. Just test it from your home computer or from same system with the command:
# ssh localhost
OR
# ssh user@your-server-ip-address

How do I use ssh client?

Assuming that your server hostname is userver.mydomain.com and username is vivek, you need to type the following command:
# ssh vivek@userver.mydomain.com
To stop ssh server, enter:
# sudo /etc/init.d/ssh stop
To start sshs server, enter:
# sudo /etc/init.d/ssh start
To restart ssh server, enter:
# sudo /etc/init.d/ssh restart

See also:

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
34 comments… add one
  • WzrdOfOost Aug 18, 2006 @ 18:52

    Nice detailed tutorial. I managed to get it all working. I wrote about it in my blog http://my-linux-server.blogspot.com

  • Tristan Garrett Feb 25, 2007 @ 0:17

    Very helpful tutorial. Thanks much!

    TG

  • Jeremy Roush Jun 1, 2007 @ 23:15

    Thanks for the write-up. Odd its not installed by default.

  • Scott Bohler Jun 17, 2007 @ 2:37

    Thank you! Up-and-running in less than 5 minutes.

    :o)

  • Krishna Oct 13, 2007 @ 11:42

    Thanks a lot – this is very helpful

  • Devvrath Nov 28, 2007 @ 4:24

    where can I find my ip address, I use the wireless network provided to me by my college.
    when I do
    “ifconfig”
    I get
    eth1 inet addr:10.XXX.XXX.XXX
    and
    lo inet addr:XXX.XXX.XXX.XXX

    now from remote, when I try
    ssh @10.XXX.XXX.XXX
    its refuse to except my password.

    also, from the other blog, i edited /etc/ssh/sshd_config file and I added line
    AllowUsers

    but its still not working. which IP address I am suppose to use.
    also, when I open a website, which gives IP address, it shows my IP address as
    127.XXX.XXX.XXX
    which is different from 10.XXX.XXX.XXX which i get using “ifconfig”
    Thanks

  • Wilfred Sep 6, 2008 @ 14:10

    Great! Thanks for the info, i need to update my sourcelist to begin with the installation.

  • Mafaioz Jan 12, 2009 @ 14:11

    Devvrath: Use your external ip, not the local ip, if both you and the server is localy, you can connect to the lokalip of the server, if your not local, use the external ip,

  • Thank You Messages Mar 4, 2009 @ 19:03

    thanks for the quality information
    however mine still not working
    it displays package not available

  • pagan Mar 7, 2009 @ 14:14

    why are the ubuntu iso,s so outdated

  • bob khatri May 18, 2009 @ 5:57

    I m enable to install ssh on ubuntu 7.0 any body have idea about it

    Thanks
    BOB

  • Gang Jul 1, 2009 @ 15:27

    Hi,

    My system is isolated from the Internet. How do I get and install OpenSSH in this env?

    Thanks,
    Gang

  • Mikey Aug 24, 2009 @ 0:16

    Hey all, I can’t seem to get my SSH to let other people connect. It works fine for any local computer on the network but if you try connecting VIA the internet it has connection errors. Does anyone know why? I was told my tunneling needs to be set so i just set tunneling to YES and it still doesn’t work…

    Thanks alot! Mikey

  • Dennis Sep 29, 2009 @ 19:09

    I have the same problem as Mikey. Anyone have a solution?

  • 🐧 nixCraft Sep 29, 2009 @ 19:30

    @ Dennis

    Open port using Firewall. You need to setup port forwarding if you are using DSL/ADSL/Cable internet.

  • Gentjan Oct 19, 2009 @ 10:35

    Thanks a lot! It’s a great tutorial!
    Gentjan

  • indra m n Oct 21, 2009 @ 2:16

    for home user that’s using DSL/ADSL/similar router, make sure that the port is forwarded to your machine.

    for other version that cant run, not sure if this will work:
    sudo apt-get update

    possibly the record in your ubuntu is not updated yet…

  • binu chandran Nov 3, 2009 @ 9:23

    This is really great.
    Very helpful for me.
    Thank you very much.

  • Srj Mar 9, 2010 @ 14:24

    I got a problem while establishing Lan between two computers in my room using SSH….
    From one computer i can access other, but i cant do the same from the other computer… it gives an error – Cannot display location “sftp://192.168.254.16/” connection refused by server……. what shd be done please help me out???

  • Ramila Bandara May 5, 2010 @ 4:40

    thanks for the quality information
    Very helpful for me.
    Thank you very much.

  • Anonymous May 15, 2010 @ 17:10

    Hi
    If I follow the steps also it is giving some unrelated error.

    i.e.,
    To access official Ubuntu documentation, please visit:
    http://help.ubuntu.com/

    0 packages can be updated.
    0 updates are security updates.

    Last login: Sat May 15 22:34:21 2010 from ash-laptop

    Error: Unknown option msgbox.
    Use –help to list options.

    what should i do ? can u please help me up?

  • Darel Oct 6, 2010 @ 19:46

    Installed and works like a charm but how to put ssh daemon in the service so i can start or stop using service sshd start/stop
    Regards
    Darel

  • Amrit pal Jan 15, 2011 @ 14:30

    when i gave ssh local ,it gave me error as
    Couldn’t establish connection to proxy: Network is unreachable
    ssh_exchange_identification: Connection closed by remote host

    what to do?

  • Const Jan 19, 2011 @ 8:47

    Thanks for author! Very helpful for nix beginner.

  • f4rr3z Jan 29, 2011 @ 18:27

    hello..how to get full tutorial abaout uubuntu server..
    it’s ubuntu server coding are different from fedora..??

  • j0s3 Feb 2, 2011 @ 18:58

    Great info. Right to the point.

  • ebookhorn Mar 3, 2011 @ 2:54

    straight forward thanks!!!

  • isaac May 27, 2011 @ 10:23

    hi i am testing SSH on linux and i am having problem connecting to the Linux SERVER. i have a client PC running Putty (shh) and a Linux SSH server (bear box modem). when i try to connect to the SSH server via a PC running Putty connected to my 3G modem i get network error: timeout. Linux box is also connected to a 3G rooter with port 22 forwarded.

    when i connect to a PC loaded with Unix or Windows running and loaded with SSH server, i can connet fine with no hassle. using the same setup

    can you please help

  • Zoffix Znet Aug 19, 2011 @ 18:08

    Well, there was nothing about configuration in this tutorial :/

  • all4naija Nov 1, 2011 @ 14:13

    Why not use a utility service with ‘ # sudo service ssh start’ which is more better than initiating init script from a folder with # sudo /etc/init.d/ssh start?

  • Janak Porwal May 12, 2012 @ 16:49

    Thanks for the quick tutorial… Helpful!

  • Krishna Nov 20, 2012 @ 12:27

    Thanks

  • john Jan 19, 2013 @ 19:25

    I installed and now doing a upgrade. My question is. If i want to conenct to it through my local network usign putty cleint. Would i just put in localhost in the host name or do i still have to put in a ip because would that not just try and connect me back to the computer im on or no? or do i use the locak ip for the machine im running my server on? Thanks. also for blind users is there a pack to use for voice to read me what is going on? I was thinking there was but forget how to get it or install it. Any help would be great.

  • Brazilian Feb 3, 2013 @ 14:00

    Thank you so much! I really appreciate that!

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.