# A few doubt over SSH

## dE_logics

So a box is called the SSH server if it's running the sshd or /etc/init.d/sshd right? Or is playing around with sshd_config necessary?

I'm having a few problems with this - 

```
 [WOMBATNET:/home/wombat/.ssh]

    $ ssh chinookfe.ucar.edu mkdir .ssh

    The authenticity of host 'chinookfe (128.117.215.218)' can't be established.

    DSA key fingerprint is 30:6b:2f:aa:64:14:6e:90:f4:43:62:11:07:f7:2b:64.

    Are you sure you want to continue connecting (yes/no)? yes

    Warning: Permanently added 'chinookfe,128.117.215.218' (DSA) to the list of known hosts.

    wombat@chinookfe's password:

    [WOMBATNET:/home/wombat/.ssh]

    $ scp authorized_keys2 chinookfe.ucar.edu:~/.ssh

    wombat@chinookfe's password:

    authorized_keys2  100% |************************************|   913       00:00
```

Here the box named WOMBATNET executed a command (mkdir .ssh) in the system with DNS chinookfe.ucar.edu.

So by default SSH is supposed to be working in the home directory of chinookfe? If so of which user?

```
The authenticity of host 'chinookfe (128.117.215.218)' can't be established.
```

Is the above message cause the public key was not present in the .ssh directory?

```
DSA key fingerprint is 30:6b:2f:aa:64:14:6e:90:f4:43:62:11:07:f7:2b:64.
```

Is the above reviled fingerprint of the system chinookfe or is it of the client's?

It it asks for a password...what is this password? Who's password is this?

Finally we do an scp to chinookfe using the same password...so again what is this password?

While doing scp, we specified '~'...which user is it?...is it assume here that the user named wombat also available in the chinookfe box?

----------

## malern

 *dE_logics wrote:*   

> So a box is called the SSH server if it's running the sshd or /etc/init.d/sshd right?

  Yes

 *Quote:*   

> Or is playing around with sshd_config necessary?

  If a machine is listening on a port which talks the ssh protocol then you could call it a ssh server. The default sshd_config is fine for doing that.

 *Quote:*   

> So by default SSH is supposed to be working in the home directory of chinookfe?

 

Yes, by default opensshd sets the working dir to be the users home dir

 *Quote:*   

> If so of which user?

  The ssh client logs in using the same user it's running as. So if you run the command as "wombat" it'll try to login as "wombat". You can specify different a username using the "-l" switch or the "username@hostname" syntax.

 *Quote:*   

> 
> 
> ```
> The authenticity of host 'chinookfe (128.117.215.218)' can't be established.
> ```
> ...

  Yes

 *Quote:*   

> 
> 
> ```
> DSA key fingerprint is 30:6b:2f:aa:64:14:6e:90:f4:43:62:11:07:f7:2b:64.
> ```
> ...

  chinookfe, the server

 *Quote:*   

> It it asks for a password...what is this password?

  Hopefully only you know the answer to this  :Smile: 

 *Quote:*   

> Who's password is this?

  It's the password for the user you logged in as on the server

 *Quote:*   

> Finally we do an scp to chinookfe using the same password...so again what is this password?

  It'll be the same as before unless someone changed it in between.

 *Quote:*   

> While doing scp, we specified '~'...which user is it?...is it assume here that the user named wombat also available in the chinookfe box?

  Yes, you're correct

----------

## desultory

 *malern wrote:*   

> The ssh client logs in using the same user it's running as. So if you run the command as "wombat" it'll try to login as "wombat". You can specify different a username using the "-l" switch or the "username@hostname" syntax.

 Just to add options, another way to specify a different user name would be to add an entry to ~/.ssh/config for that host which includes a user name to use when connecting to that host.

```
Host *.ucar.edu

   User wombat

```

That would make ssh default to using the user name wombat when connection to any host in the ucar.edu domain, regardless of the local user name, unless overridden by arguments on the command line or another host entry which took precedence.

----------

## dE_logics

Ok, thanks. That cleared things up.

----------

## dE_logics

Instead of using scp, can we use cp over ssh? - 

ssh de@192.128.7.9 cp /home/test/.ssh/authorized_keys2 192.128.7.9:/home/de/.ssh/

----------

## desultory

 *dE_logics wrote:*   

> Instead of using scp, can we use cp over ssh? - 
> 
> ssh de@192.128.7.9 cp /home/test/.ssh/authorized_keys2 192.128.7.9:/home/de/.ssh/

 Not with cp, though a similar effect can be produced with tar.

```
tar czf - -C ~ .ssh/authorized_keys2 | ssh de@192.128.7.9 tar xzf -
```

----------

## richard.scott

 *dE_logics wrote:*   

> Instead of using scp, can we use cp over ssh? - 
> 
> ssh de@192.128.7.9 cp /home/test/.ssh/authorized_keys2 192.128.7.9:/home/de/.ssh/

 

scp is cp over ssh.

The command you want to use won't work as it will be executed on the remote server so won't work.

----------

## dE_logics

Oh...I see, thanks for clarifying that.

----------

