DEV Community

How to Set up an SSH Server on a Home Computer

Zach Duey on August 27, 2017

Around 18 months ago, I built a desktop computer so I would have a little more firepower at my fingertips when I needed it. My hope was to avoid ...
Collapse
 
sraman profile image
S.R. Aman

Hey! I am a noob at all these things. When I do ifconfig it shows eno1 not eth0. Are those same? Because I am using Ubuntu 16.04. And nothing shows when I do ifconfig | grep "inet addr". And When I ifconfig | grep inet, then some IP address shows up when I try to ssh using a different machine from the different network. It shows me "error :ssh_exchange_identification: read: Connection reset by peer". Can you tell what I am doing wrong?

Collapse
 
bgadrian profile image
Adrian B.G.

I don't know but here are 2 tips:

Use ip not ifconfig, see how and why

Use ssh -vvv verbose mode which will tell you more details why it failed.

Collapse
 
cwoz117 profile image
Chris • Edited

Eth0 was an old convention and is used when the OS can't determine where the card is.

Eno refers to an interface on the motherboard, with the # representing which interface (for servers with more than 1) there's another set of letters to identify expansion card interfaces, but it's a google search away

This new convention is more in line with how Linux names their storage devices ie: sda, vdb, etc..

Collapse
 
crowchirp profile image
Conner

Great work, all i needed to do was the openssh-server package, the sshclient is provided with GitBash for windows, which is probably installed. but i guess iwould have to port forward to do this anywhere else, my use case is just windows machine to my linux machine

Collapse
 
tommi profile image
Tommi • Edited

Hi, thanks a lot for your guide! It has been very insightful and useful.

Unfortunately, I encountered a problem I did not expect, and I do not know how to fix this.

For a few days after I configured my devices everything ran smoothly. Nevertheless, all of a sudden, I could not log in my home computer anymore and I found out that the public IP address of my home network changed.

Do you have any idea how this could happen? I may have rebooted my router one time, but I did not know that at every reboot the IP address changes. How can I keep it the same?

Thanks a lot!

Best,

T

Collapse
 
jmjl profile image
Julian Marcos

Use a DDNS Service, i have maken a comment in this thread, and i dont want to copy/paste that comment, link

Collapse
 
tommi profile image
Tommi

Thanks a lot. Sorry I missed it!

Best,

T

Thread Thread
 
jmjl profile image
Julian Marcos

No problem, i had just maken that comment a few minutes ago...

Collapse
 
iaziz786 profile image
Mohammad Aziz

My broadband provider has provided me with private IP. I checked my IP at whatsmyip.org, which is different from the IP showing at my details WAN. Do I have to buy a public IP from them or I can buy that from anyone else?

Collapse
 
crowchirp profile image
Conner

yo wtfismyip.com is way better alternative

Collapse
 
jmjl profile image
Julian Marcos

IP getting

Some options

DDNS ( Dynamic Domain Name Service )

A popular example is Duckdns, or FreeDNS, these services let your server make a request and get one of their subdomains point to you instead of using an IP address

Collapse
 
arq_2002 profile image
Arslan iftikhar

Very well written i learned a lot from this however i am stuck with weird issue i was attempting to log in from different network but i am getting permission denied error any idea what is causing this because i can log in from the same network

Collapse
 
bhavykhatri profile image
bhavykhatri • Edited

sudo restart(or stop or start) ssh

doesn't work anymore on recent ubuntu OS (16.04 and above). To start your ssh server you need to use:

sudo systemctl start ssh.

Collapse
 
sraman profile image
S.R. Aman • Edited

Hey brother! Can you tell something about eth0 and eno1? Can read you my comment above or below and help me?

Collapse
 
prodyte profile image
Pawan Kumar

Nice one, btw the ifconfig doesn't work for me, ip is the alternative.

Collapse
 
tohasull profile image
Tom Sullivan

Thanks Zach. I can now access two small servers on my private local network from anywhere I have Internet access. I connect to my desktop and ssh from there to the other machines. Next I plan on bumping up the security as you discuss in the last section.

Collapse
 
hakkm profile image
Abdelhakim khabir

i think ssh stands for secure shell not secure socket shell

Collapse
 
altxz profile image
Phรกt

Thanks for the tutorial

Collapse
 
ezeelogin profile image
Ezeelogin

Very informative article thanks for shaing with us...

Collapse
 
samjoel20 profile image
SamJoel20

How to setup my server if I do not have a router and forwarding port is not an option??

Collapse
 
pra3t0r5 profile image
Pra3t0r5

Awesome!

Collapse
 
wvisee profile image
Wvisee

Thanks a lot for this tutorial ! It helped me a lot :D

Collapse
 
lurchssmith profile image
lurch-ssmith

Zach, awesome guide. Very easy to follow even for someone new to these concepts.

Collapse
 
turboknul profile image
Niek de Schipper

Great article, got my server up and running in no time!

Collapse
 
bamboocoffee profile image
Bamboocoffee

Awesome stuff! Thanks Zach

Collapse
 
rektdeckard profile image
Tobias Fried

Nice guide! Is it possible to listen on Port 22 for local connections only, and expose Port e.g. 1337 for remote connections?

Collapse
 
praneethmendu profile image
Praneeth Mendu

a port scanner shows that only ports 21 and 80 are open on my public IP. Does this mean I cannot use true ssh without the help of my IPS ??

Collapse
 
lastpayload244 profile image
Lastpayload244

No you have to open the ports through your router and The ISP doesnt have to get involved and also you can use whatever port youd like