SSH-COPY-ID

`ssh-copy-id` is a utility that comes with OpenSSH, and is used to install a user's public key in a remote machine's authorized keys file. This allows the user to log in to the remote machine without entering a password.

Here's how it works:

- The user generates a key pair (a private key and a public key) using a tool like `ssh-keygen`.

- The user copies the public key to the remote machine using `ssh-copy-id`. This command will add the public key to the `authorized_keys` file in the user's home directory on the remote machine.


ssh-copy-id -i ~/.ssh/id_rsa_mykey.pub user@remote-server



- The user can now log in to the remote machine using their private key, without being prompted for a password.


`ssh-copy-id` is a convenient way to set up passwordless authentication between two machines, especially if you need to do this for multiple users or on multiple machines. It's also more secure than using passwords, since it's based on public-key cryptography.

Here's an example of using `ssh-copy-id` with the details you provided:


```

ssh-keygen -t ecdsa -b 256 -C "swain@lalatendu.info" -f ~/.ssh/id_ecdsa_lalatendu

ssh-copy-id -i ~/.ssh/id_ecdsa_lalatendu.pub lalatendu@192.168.1.10

```

- The `-t` option specifies the type of key to generate. In this case, we're using `ecdsa`, which stands for Elliptic Curve Digital Signature Algorithm. This is a type of public-key cryptography that is based on elliptic curves and is generally considered to be more secure than older algorithms like RSA and DSA.

- The `-b` option specifies the number of bits in the key. In this case, we're using a key size of 256 bits. Larger key sizes generally offer more security, but may also be slower to generate and use.

- The `-C` option adds a comment to the key. In this case, we're adding an email address (`swain@lalatendu.info`) as a way of identifying the key's owner.

- The `-f` option specifies the filename for the private key. In this case, we're using `id_ecdsa_lalatendu` as the filename. By default, `ssh-keygen` will create files with names like `id_rsa` and `id_dsa` in the `.ssh` directory of your home directory.

- The `-i` option specifies the filename of the public key to copy. In this case, we're using `id_ecdsa_lalatendu.pub`, which is the default name for the public key generated by `ssh-keygen` with the `-f` option we used earlier.


Finally, the `lalatendu@192.168.1.10` argument specifies the username and IP address of the remote server. This is the server to which we want to copy the public key. When you run `ssh-copy-id`, you'll be prompted to enter the password for the specified user on the remote server, as a way of authorizing the addition of your public key to the list of authorized keys on the remote server. In this example, we're using `ssh-keygen` to generate an ECDSA key pair with a key size of 256 bits, and a custom filename for the private key (`id_ecdsa_lalatendu`). We're also adding a comment to the key using the `-C` option. Then, we're using `ssh-copy-id` to copy the public key (`id_ecdsa_lalatendu.pub`) to the remote server at IP address `192.168.1.10`, for the user `lalatendu`. 

You'll be prompted to enter the password for the `lalatendu` user on the remote server, to authorize the addition of your public key to the authorized keys list. Once you enter the password, the public key will be copied to the appropriate location on the remote server and you'll be able to log in to the server without a password.


Remember to keep your private key (`id_ecdsa_lalatendu`) safe, and never share it with anyone.

More about : SSH-KEYGEN , SSH-COPY-ID , RSA , DSA & ECDSA