# clueless with openssh

## Raoul_Duke

Can anyone point me in the direction of a good newbie tutorial for using openssh. I've just installed gentoo on an old box to use as a file-server and i want to connect remotely.

I've got sshd running on the server but when i try to connect from another machine on the network using the hostname i get:

```
root@trotsky mike # ssh stalin

ssh: stalin: Name or service not known
```

If i use the ip i get:

```
ssh 192.168.x.xx

ssh: connect to host 192.168.x.xx port 22: Connection refused
```

Any clues.......i can't seem to get any search results that explain the basics 

 :Embarassed: 

----------

## meowsqueak

SSH howtos and basics are all over the place. You obviously didn't look very hard - try googling for 'ssh tutorial'. That's all I'm going to say.

----------

## Cyris

Damn, meowsqueak.  You don't have to be so damn rude about it.  That attitude is what makes forums useless and unwanted.  I seriously doubt that this guy wanted you to hold his hand, just give him a little direction.  He is obviously new to Gentoo and/or Linux.  All you had to say was try searching google for ssh tutorial or check the LDP.

Forgive him for not being a GURU such as you.

----------

## OneOfOne

first add your computer name/ip to /etc/hosts

```
127.0.0.1      mycomp
```

2. have you started sshd on that computer?

/etc/init.d/sshd start

peace

----------

## meowsqueak

 *Cyris wrote:*   

> Damn, meowsqueak.  You don't have to be so damn rude about it.  That attitude is what makes forums useless and unwanted.  I seriously doubt that this guy wanted you to hold his hand, just give him a little direction.  He is obviously new to Gentoo and/or Linux.  All you had to say was try searching google for ssh tutorial or check the LDP.
> 
> Forgive him for not being a GURU such as you.

 

This is a joke, right? With over 450 posts I wouldn't consider him/her 'new to Gentoo and/or Linux' based on that, but you might be right.

However, your point is taken, thank you. I could have been less abrupt and more polite. My post was actually quite helpful - if you follow my suggestion, you get a lot of useful results.

----------

## waverider202

The reason you got a connection refused is because sshd is not running.  Run:

rc-update add sshd default

That will start sshd on startup, but you can do a:

/etc/init.d/sshd start

to get it running.  The reason for getting an unknown hostname is because the one computer doens't know about that host name.  You can tell the remote computer the name through the hosts file, or through a dns server.  Also, don't get discouraged, other people in this forum are very fast to yell, saying to google for something, but some people actually like more human interaction than that.  Also, sometimes, its faster to have someone that's been a newbie before, to help you with you problem.  With this issue, I am so used to having sshd running from the get go, that 1/2 the time, when I reinstall gentoo, I completely forget that I have to add sshd, and I run in circles trying to figure out why.  Then I hit myself.  It is these simple little mistakes that the forums are great for.  If other uses think its a waste of time, then don't read their post, cause you are wasting your time by writing stupid comments about other users.

----------

## meowsqueak

 *Raoul_Duke wrote:*   

> Any clues.......i can't seem to get any search results that explain the basics

 

I answered his question, purely and simply. How can you do better than that?

----------

## Raoul_Duke

Don't stress guys......i'm not a n00b but i'm very new to networking and the like. My problem turned out to be to do with keys   :Embarassed: 

It actually took a lot of googling to find something very simple.........my post was because i was getting frustrated and hoped that another gentoo'er would point me in the right direction.

Thank you to those who tried to help   :Very Happy: 

----------

## undrwater

Well i'm having similar troubles....googled and all...but no solution  :Razz: 

sshd is running, everything is ok...but still connection refused.

trying ssh from Zaurus to gentoo box...linksys router forwarding port 22.

----------

## undrwater

Hmm...i was able to ssh from outside of my network...but not from the Z inside the network.

----------

## kwiqsilver

undrwater, 

Are you trying to ssh into the router's IP address, but hoping it forwards to your other box?

If so that's the problem. My linksys router has the same quirk, it won't port forward requests from the LAN. It only forwards external requests. You'll have to ssh directly into the server from inside.

I created a perl script wrapper for cvs (using ssh) on my notebook that determined based on my IP address whether I was at home or work, then changed the host name in the "CVS/Root" files and the $CVSROOT variable between my internal name and external one.

You can do the same for ssh.

Something like

```

#!/usr/bin/perl -w

my $user = "userid";

my $ip = #Get the IP address from ifconfig...I forget exactly how right now.

my $host = ($ip =~ m#^192\.168\.1\.#) ? "internal-name" : "external-name.domain.tld";

exec "/usr/bin/ssh $user@$host";

```

This assumes that you'll always have a similar IP address when connecting from inside, which is probably a safe assumption.

----------

## undrwater

[quote]Are you trying to ssh into the router's IP address, but hoping it forwards to your other box? 

 *Quote:*   

> 
> 
> Heh, no....but that's an interesting idea...i had actually tried to ssh to the server's ip, not the router's.  the server has an ip of 192.168.1.104 and my Z has an ip of 192.168.81.5.  i don't have a strong handle on networking details, but i'm guessing i'm having problems because the Z's ip is outside my network's subnet...am i correct?
> 
> hmm...come to think of it....i created a secondary ip for the computer for syncing with the Z (192.168.81.1), i'll have to try ssh to that address.

 

----------

## kwiqsilver

Let us know if that solves the problem. I don't know a whole lot about IP addresses and subnets and all, but I think that'll fix it. I've had problems setting up lan games when people are on different subnets, so I think that'll do it.

Woohoo!! The gentoo forum has finally decreed that I am no longer a n00b.

----------

