# The Ubuntu Forum Community > Ubuntu Official Flavours Support > Networking & Wireless > [SOLVED] SSH: Permission denied (publickey,password)

## DevinJCan

Hello and thanks for checking out my thread.

I am having an issue authenticating a remote host via SSH to which I am connected via cross-over cable. The remote host I am attempting to access is in my apartment and is running Ubuntu 10.04 Lucid. I have ran the sudo apt-get install ssh and can ping the PC. Also, I am running Ubuntu 11.04 on my main PC.

I need to check into the implications of public key authentication vs straight pass-phrase authentication. I am not going to be connecting over a wan and I may want to in the future.

so, what do I do to control the PC from the other end of my apartment?



/etc/ssh/ssh_config



> # This is the ssh client system-wide configuration file.  See
> # ssh_config(5) for more information.  This file provides defaults for
> # users, and the values can be changed in per-user configuration files
> # or on the command line.
> 
> # Configuration data is parsed as follows:
> #  1. command line options
> #  2. user-specific file
> #  3. system-wide file
> ...


Any ideas/solutions will be greatly appreciated. I am a full time student studying IT-Sec. I am a newbie and looking for guidance. Thank you.

----------


## gdonwallace

I have never tried to use SSH on two machines that are physically connected to each other.  I guess the first question would be is SSH installed and running on both machines.  

I know that there is a way to have SSH generate the key to use for the connection, I am at work right now and don't have access to that information.  Google ssh, there is a location that has a lot of really good information available on how to setup and use SSH.

Hope that helps.

----------


## smurphy_it

First you need to verify that SSH daemon is waiting for connections.  You can do that from the machine itself, or you can simply use telnet if you wish.

On physical machine:


```
netstat -ant |grep LISTEN
```

From remote machine:


```
telnet HOSTNAME 22
```

Pass-phrase vs. Key authentication.  If the machine is to be "accessible" from the internet, you'll want to use key'd authentication with a passphrase.  Password only would be subject to brute force password attacks.

To generate the ssh key(s), you can use rsa or dsa.



```
ssh-keygen -t rsa
```

or


```
ssh-keygen -t dsa
```

----------


## collisionystm

you can use public key if you do not want to put in a password everytime.

On your server 



```
sudo apt-get install ssh
```

On your personal computer



```
ssh-keygen
```

Enter through all the prompts... no password.



```
cd /home/username/.ssh
```



```
vi id_rsa.pub
```

Copy all the text in here

type 

```
:q!
```

 to exit

ssh to your server



```
cd .ssh
```



```
nano authorized_keys
```

paste contents

CTRL+X then Y to save

exit out of the ssh

ssh to your server again... should not ask for password anymore.

----------


## DevinJCan

Ah, Thank you collisionystm. That was what I was looking to do!

----------


## collisionystm

> Ah, Thank you collisionystm. That was what I was looking to do!


No problem.. done it a million times. Glad to help.

----------

