Reply to comment

Share SSH Public Key Authentication

Sometimes you have access in a server using SSH, but is annoying type your username and password every time do you want access this server, below you can find the instructions to share ssh credentials to avoid manual authentication.

1. Key Generation

The public portion of the RSA key pair must be copied to any servers that will be accessed by the client.

client$ mkdir ~/.ssh
client$ chmod 700 ~/.ssh
client$ ssh-keygen -q -f ~/.ssh/id_rsa -t rsa
Enter passphrase (empty for no passphrase): ...
Enter same passphrase again: ...

The file permissions should be locked down to prevent other users from being able to read the key pair data. OpenSSH may also refuse to support public key authentication if the file permissions are too open. These fixes should be done on all systems involved.

client$ chmod go-w ~/
client$ chmod 700 ~/.ssh
client$ chmod go-rwx ~/.ssh/*

2. Key Distribution

The public portion of the RSA key pair must be copied to any servers that will be accessed by the client.

# first, upload public key from client to server
client$ scp ~/.ssh/id_rsa.pub server.example.org:~

# next, setup the public key on server
server$ mkdir ~/.ssh
server$ chmod 700 ~/.ssh
server$ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
server$ chmod 600 ~/.ssh/authorized_keys
server$ rm ~/id_rsa.pub

After complete this process maybe do you want read an article about how sync remote folder here

Enjoy it.

enzo

Reply

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <b> <address> <blockquote> <br> <caption> <center> <code> <dd> <del> <div> <dl> <dt> <em> <font> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <li> <ol> <p> <pre> <span> <strong> <sub> <sup> <table> <tbody> <td> <tfoot> <th> <thead> <tr> <u> <ul> <tr>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
8 + 10 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.