Last active 1 week ago

Korbs's Avatar Korbs revised this gist 4 months ago. Go to revision

1 file changed, 2 insertions, 2 deletions

README.md

@@ -8,7 +8,7 @@ All of the commands listed below are to be run on the client-side only.
8 8
9 9 Generate an RSA Keypair using `ssh-keygen`, run the following:
10 10 ```bash
11 - ssh-keygen
11 + ssh-keygen -t rsa -b 4096
12 12 ```
13 13
14 14 For all options that'll be propmpt, you can just press Enter and leave your ouput plank. Optionally, you can name the RSA file if you want.
@@ -17,7 +17,7 @@ For all options that'll be propmpt, you can just press Enter and leave your oupu
17 17
18 18 The server will need to know the key as well, copy it with `ssh-copy-id`, run the following:
19 19 ```bash
20 - ssh-copy-id USERNAME@HOSTNAME
20 + cat ~/.ssh/id_rsa.pub | ssh USERNAME@HOST "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
21 21 ```
22 22
23 23 ## Login

Korbs's Avatar Korbs revised this gist 8 months ago. Go to revision

1 file changed, 34 insertions, 1 deletion

README.md

@@ -1 +1,34 @@
1 - https://overflow.sudovanilla.org/exchange/serverfault.com/questions/241588/how-to-automate-ssh-login-with-password#330740
1 + # Login via SSH Passwordless
2 +
3 + Allow yourself to remotely login to your server without the need of typing in the password.
4 +
5 + All of the commands listed below are to be run on the client-side only.
6 +
7 + ## Generate RSA Keypair
8 +
9 + Generate an RSA Keypair using `ssh-keygen`, run the following:
10 + ```bash
11 + ssh-keygen
12 + ```
13 +
14 + For all options that'll be propmpt, you can just press Enter and leave your ouput plank. Optionally, you can name the RSA file if you want.
15 +
16 + ## Copy RSA Keypair to Server
17 +
18 + The server will need to know the key as well, copy it with `ssh-copy-id`, run the following:
19 + ```bash
20 + ssh-copy-id USERNAME@HOSTNAME
21 + ```
22 +
23 + ## Login
24 + If everything went smoothly, it should of, you'll now be able to login skipping the need to type in a password.
25 +
26 + ```bash
27 + ssh USERNAME@HOSTNAME
28 + ```
29 +
30 + > **WARNING**: By leaving SSH keys like this exposed, without encrypting them is not best practice, even if you encrypt your partition where the SSH keyss live. It is actually much safer to continue without this tutorial altogether, requiring yourself to enter the server's password login. Try using, if you prefer, using tools such as Keychain (macOS or Linux), or SSH agent to remember the password until you either logout, suspend, or timeout.
31 +
32 + ___
33 +
34 + This tutorial is based on [jzap](https://serverfault.com/users/67547/lzap)'s [comment](https://serverfault.com/users/67547/lzap) found on Server Fault.

Korbs's Avatar Korbs revised this gist 8 months ago. Go to revision

1 file changed, 1 insertion

README.md(file created)

@@ -0,0 +1 @@
1 + https://overflow.sudovanilla.org/exchange/serverfault.com/questions/241588/how-to-automate-ssh-login-with-password#330740
Newer Older