create account

Password-Less SSH Access to Your Linux Machine or Raspberry Pi Using Public Keys by makerhacks

View this thread on: hive.blogpeakd.comecency.com
· @makerhacks ·
$32.67
Password-Less SSH Access to Your Linux Machine or Raspberry Pi Using Public Keys
<img src="https://makerhacks.com/wp-content/uploads/2018/03/bigstock-Choosing-the-key-to-success-fr-149892281.jpg" alt="Password-Less SSH Login Linux" width="723" height="527" /><br>

If you are logging in and out of a Linux machine, especially a Raspberry Pi on your local network, it can be a pain to keep entering a password. The longer and more secure your password, the more of a pain it can be. If only there was a secure but convenient alternative ...

Well, there is!
<h3>SSH and Public Keys</h3>
What we are going to do is set up a trusted kind of authentication for our shell access between the two computers. Technically we are creating what is called a "2048 bit RSA key pair". A bit like a super-password that you don't have to type in every time :)
<h3>The Steps</h3>
First, we need to see if you already have a key on your local machine by logging into your local terminal and using:

<code>ls ~/.ssh</code>

If you don't see a .pub file then you need one extra step. Enter:

<code>ssh-keygen </code>

to create one (just accepting the defaults is fine as prompted, unless you are more knowledgeable). You will get a couple of new files.

<strong>id_rsa.pub</strong> is your public key, which is what you share with the world.

Keep any other files private, especially your <strong>id_rsa</strong>, which is your private key.

Next, you need to output your file to the terminal so you can copy it to your clipboard, or you can FTP it up to the server if that is easier.

<code>cat ~/.ssh/id_rsa.pub</code>

Copy and paste to the terminal as part of this command:

<code>echo ssh-rsa [YOUR COPYPASTE HERE] &gt;&gt; ~/.ssh/authorized_keys</code>

This appends the key to your Authorized Keys file, essentially saying you get to log in without entering a password in future :)

(If the directory does not exist then <code>mkdir ~/.ssh</code> and try again)

Finally, set the permissions:

<code>chmod 600 ~/.ssh/authorized_keys</code>

That's it, you should now have freedom from passwords, at least between those two SSH terminals ;)

<div>
<ul>
 	<li><sub>Image Source: BigStock</sub></li>
</ul></div><br /><center><hr/><em>Posted from my blog with <a href='https://wordpress.org/plugins/steempress/'>SteemPress</a> : https://makerhacks.com/ssh-linux-raspberrypi-public-keys/</em><hr/></center>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authormakerhacks
permlinkpassword-lesssshaccesstoyourlinuxmachineorraspberrypiusingpublickeys-g9zd17bv4g
categorygeek
json_metadata{"community":"steempress","app":"steempress/1.0.1","tags":["geek","linux","making","programming","technology"]}
created2018-03-03 00:21:54
last_update2018-03-03 00:21:54
depth0
children7
last_payout2018-03-10 00:21:54
cashout_time1969-12-31 23:59:59
total_payout_value31.668 HBD
curator_payout_value1.006 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,351
author_reputation156,977,359,570,955
root_title"Password-Less SSH Access to Your Linux Machine or Raspberry Pi Using Public Keys"
beneficiaries
0.
accountfredrikaa
weight500
1.
accounthowo
weight500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,753,254
net_rshares8,054,337,419,657
author_curate_reward""
vote details (36)
@cloudspyder ·
Better to type in password often, what if your machine stole or another user get an access your super user now is on the risk.
properties (22)
authorcloudspyder
permlinkre-makerhacks-201833t93550548z
categorygeek
json_metadata{"tags":["geek","linux","making","programming","technology"],"app":"esteem/1.5.1","format":"markdown+html","community":"esteem"}
created2018-03-03 01:35:57
last_update2018-03-03 01:35:57
depth1
children1
last_payout2018-03-10 01:35:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length126
author_reputation8,281,689,777,163
root_title"Password-Less SSH Access to Your Linux Machine or Raspberry Pi Using Public Keys"
beneficiaries
0.
accountesteemapp
weight1,000
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,764,855
net_rshares0
@makerhacks ·
If someone gets physical access to my machine and manages to log into it then I have bigger problems than my dev server being logged into ...
properties (22)
authormakerhacks
permlinkre-cloudspyder-re-makerhacks-201833t93550548z-20180303t013718297z
categorygeek
json_metadata{"tags":["geek"],"app":"steemit/0.1"}
created2018-03-03 01:37:18
last_update2018-03-03 01:37:18
depth2
children0
last_payout2018-03-10 01:37:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length141
author_reputation156,977,359,570,955
root_title"Password-Less SSH Access to Your Linux Machine or Raspberry Pi Using Public Keys"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,765,054
net_rshares0
@mrshahriar ·
Interesting information........


Please upvote my comment and post......
properties (22)
authormrshahriar
permlinkre-makerhacks-password-lesssshaccesstoyourlinuxmachineorraspberrypiusingpublickeys-g9zd17bv4g-20180303t050054311z
categorygeek
json_metadata{"tags":["geek"],"app":"steemit/0.1"}
created2018-03-03 05:00:57
last_update2018-03-03 05:00:57
depth1
children0
last_payout2018-03-10 05:00:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length73
author_reputation90,672,800,320
root_title"Password-Less SSH Access to Your Linux Machine or Raspberry Pi Using Public Keys"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,797,935
net_rshares0
@steemtux ·
I always use keys with SSH, and always turn off ssh password auth. Especially on servers that are open to the Internet.

Also `chmod 700 ~/.ssh` to make sure the .ssh directory is only writeable by you.
👍  
properties (23)
authorsteemtux
permlinkre-makerhacks-password-lesssshaccesstoyourlinuxmachineorraspberrypiusingpublickeys-g9zd17bv4g-20180303t011728959z
categorygeek
json_metadata{"tags":["geek"],"app":"steemit/0.1"}
created2018-03-03 01:17:30
last_update2018-03-03 01:17:30
depth1
children0
last_payout2018-03-10 01:17:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length202
author_reputation170,129,148,681
root_title"Password-Less SSH Access to Your Linux Machine or Raspberry Pi Using Public Keys"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,762,046
net_rshares3,145,811,533
author_curate_reward""
vote details (1)
@throwawayaccount ·
Have a look at the command:

```
$ ssh-copy-id user@box.com
```
👍  
properties (23)
authorthrowawayaccount
permlinkre-makerhacks-password-lesssshaccesstoyourlinuxmachineorraspberrypiusingpublickeys-g9zd17bv4g-20180310t062314145z
categorygeek
json_metadata{"tags":["geek"],"app":"steemit/0.1"}
created2018-03-10 06:23:33
last_update2018-03-10 06:23:33
depth1
children0
last_payout2018-03-17 06:23:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length63
author_reputation-479,586,892,695
root_title"Password-Less SSH Access to Your Linux Machine or Raspberry Pi Using Public Keys"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id43,462,707
net_rshares1,689,992,159
author_curate_reward""
vote details (1)
@throwawayaccount ·
Here are some links for those interested that are related to this post:
https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2
https://www.digitalocean.com/community/tutorials/ssh-essentials-working-with-ssh-servers-clients-and-keys

This series of tutorial from the funtoo guys is very cool if you want to understand the topic in more depth:
https://www.funtoo.org/OpenSSH_Key_Management,_Part_1
https://www.funtoo.org/OpenSSH_Key_Management,_Part_2
https://www.funtoo.org/OpenSSH_Key_Management,_Part_3
properties (22)
authorthrowawayaccount
permlinkre-makerhacks-password-lesssshaccesstoyourlinuxmachineorraspberrypiusingpublickeys-g9zd17bv4g-20180310t063027220z
categorygeek
json_metadata{"tags":["geek"],"links":["https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2","https://www.digitalocean.com/community/tutorials/ssh-essentials-working-with-ssh-servers-clients-and-keys","https://www.funtoo.org/OpenSSH_Key_Management,_Part_1","https://www.funtoo.org/OpenSSH_Key_Management,_Part_2","https://www.funtoo.org/OpenSSH_Key_Management,_Part_3"],"app":"steemit/0.1"}
created2018-03-10 06:30:48
last_update2018-03-10 06:30:48
depth1
children0
last_payout2018-03-17 06:30:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length524
author_reputation-479,586,892,695
root_title"Password-Less SSH Access to Your Linux Machine or Raspberry Pi Using Public Keys"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id43,463,604
net_rshares0
@tts ·
To hear the speech version of this post click the play image.
[![](https://s18.postimg.org/51o0kpijd/play200x46.png)](http://tts.giize.com/makerhacks__password-lesssshaccesstoyourlinuxmachineorraspberrypiusingpublickeys-g9zd17bv4g.mp3)
Brought to you by [@tts](https://steemit.com/tts/@tts/introduction). If you find it useful please consider upvote this reply.
properties (22)
authortts
permlinkre-password-lesssshaccesstoyourlinuxmachineorraspberrypiusingpublickeys-g9zd17bv4g-20180303t004113
categorygeek
json_metadata""
created2018-03-03 00:41:12
last_update2018-03-03 00:41:12
depth1
children0
last_payout2018-03-10 00:41:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length361
author_reputation-4,535,154,553,995
root_title"Password-Less SSH Access to Your Linux Machine or Raspberry Pi Using Public Keys"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,756,164
net_rshares0