> For the complete documentation index, see [llms.txt](https://prime-stake-pool.gitbook.io/node-setup-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://prime-stake-pool.gitbook.io/node-setup-guide/server-setup-basics/how-to-setup-your-cloud-server-securely/use-ssh-key-pair-to-access-your-server/copy-rsa-public-key-to-remote-server.md).

# Copy rsa public key to remote server

Establish a secure connection via ssh

This rsa public key displayed on your local computer also need to be copied to your remote computer to establish a secure connection via ssh. There are various methods to do so:

1\) Copying Public Key Using ssh-copy-id

2\) Copying Public Key Using SSH

3\) Copying Public Key Manually

Windows PowerShell does not support all the commands. Methods 1 and 3 may not work on PowerShell but it will definitely work on Ubuntu. Here we will be using method 2 on PowerShell. For details on all the methods you can check the tutorial [here](https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-20-04).

<figure><img src="https://1333520747-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjnxYeTEvdhQuzHnaDHIu%2Fuploads%2F8YjGq7RVOvwaJ62PShVz%2Fp19p.png?alt=media&amp;token=8d0f2144-2b3a-4a6d-afb2-db1e43eef64b" alt=""><figcaption></figcaption></figure>

So by method 2 use the following command on your local computer to copy the rsa public key to your remote computer:

```
cat ~/.ssh/id_rsa.pub | ssh username@remote_host "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys && chmod -R go= ~/.ssh && cat >> ~/.ssh/authorized_keys" 
```

Enter your username and remote server ip address on 'username\@remote\_host'. Here we use '<rocket@5.189.149.230>'

<figure><img src="https://1333520747-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjnxYeTEvdhQuzHnaDHIu%2Fuploads%2Fsh2pJX7c3rjXCW7ydF0c%2Fp20p.png?alt=media&amp;token=a56da18d-f5aa-46b8-b510-2f0d5311008f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1333520747-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjnxYeTEvdhQuzHnaDHIu%2Fuploads%2FLVcz0mLQUJ4V6DTeAMqj%2Fp21p.png?alt=media&amp;token=4311731d-f80e-4065-af4f-44a3ac89ebc9" alt=""><figcaption></figcaption></figure>

You need to enter password of your remote server with user/login as 'rocket'.

<figure><img src="https://1333520747-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjnxYeTEvdhQuzHnaDHIu%2Fuploads%2FtgsrJT7THFzqYWnq2d1n%2Fp22p.png?alt=media&amp;token=f0eced25-556f-4e76-898c-84efd67bed76" alt=""><figcaption></figcaption></figure>

Also you need to enter passphrase for the rsa public key on your local computer.

You are now logged in as user 'rocket' on your remote server

<figure><img src="https://1333520747-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjnxYeTEvdhQuzHnaDHIu%2Fuploads%2FDafIZ7OYDtV8sgx6C7GU%2Fp23p.png?alt=media&amp;token=4d6e400c-f724-451a-bd18-d52764fc3f5a" alt=""><figcaption></figcaption></figure>

Now let's check the hidden files and folders with command:

```
 ls -a 
```

.bash\_history .bash\_layout .bashrc .cache .local .profile .ssh .sudo\_as\_admin\_successful

<figure><img src="https://1333520747-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjnxYeTEvdhQuzHnaDHIu%2Fuploads%2Fy43PH6v1a6st8SDanvfi%2Fp24p.png?alt=media&amp;token=de0a15d3-da52-41e9-b022-65163ca89ed6" alt=""><figcaption></figcaption></figure>

Now let's check contents of the folder .ssh :

```
cd .ssh
```

```
ls
```

authorized\_keys

```
sudo nano authorized_keys
```

This is the same key as in you local computer 'rsa.pub'.

<figure><img src="https://1333520747-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjnxYeTEvdhQuzHnaDHIu%2Fuploads%2FCSg7cHCeYbAtUJm08qIR%2Fp25p.png?alt=media&amp;token=93a1ef98-7855-458b-80f6-c57a73b79e5d" alt=""><figcaption></figcaption></figure>
