≡ Menu

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?

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:

Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?

{ 34 comments… add one }

  • WzrdOfOost August 18, 2006, 6:52 pm

    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 February 25, 2007, 12:17 am

    Very helpful tutorial. Thanks much!

    TG

  • Jeremy Roush June 1, 2007, 11:15 pm

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

  • Scott Bohler June 17, 2007, 2:37 am

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

    :o)

  • Krishna October 13, 2007, 11:42 am

    Thanks a lot – this is very helpful

  • Devvrath November 28, 2007, 4:24 am

    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 September 6, 2008, 2:10 pm

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

  • Mafaioz January 12, 2009, 2:11 pm

    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 March 4, 2009, 7:03 pm

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

  • pagan March 7, 2009, 2:14 pm

    why are the ubuntu iso,s so outdated

  • bob khatri May 18, 2009, 5:57 am

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

    Thanks
    BOB

  • Gang July 1, 2009, 3:27 pm

    Hi,

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

    Thanks,
    Gang

  • Mikey August 24, 2009, 12:16 am

    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 September 29, 2009, 7:09 pm

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

  • nixCraft September 29, 2009, 7:30 pm

    @ Dennis

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

  • Gentjan October 19, 2009, 10:35 am

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

  • indra m n October 21, 2009, 2:16 am

    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 November 3, 2009, 9:23 am

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

  • Srj March 9, 2010, 2:24 pm

    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 am

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

  • Anonymous May 15, 2010, 5:10 pm

    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 October 6, 2010, 7:46 pm

    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 January 15, 2011, 2:30 pm

    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 January 19, 2011, 8:47 am

    Thanks for author! Very helpful for nix beginner.

  • f4rr3z January 29, 2011, 6:27 pm

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

  • j0s3 February 2, 2011, 6:58 pm

    Great info. Right to the point.

  • ebookhorn March 3, 2011, 2:54 am

    straight forward thanks!!!

  • isaac May 27, 2011, 10:23 am

    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 August 19, 2011, 6:08 pm

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

  • all4naija November 1, 2011, 2:13 pm

    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, 4:49 pm

    Thanks for the quick tutorial… Helpful!

  • Krishna November 20, 2012, 12:27 pm

    Thanks

  • john January 19, 2013, 7:25 pm

    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 February 3, 2013, 2:00 pm

    Thank you so much! I really appreciate that!

Leave a Comment