Setup public/ private key authentication with ssh, scp, etc. Simple bash login one-liner

By neokrates, written on November 26, 2010

Bash   snippet

Rate it
  • 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...
Ad
Poll
  • Which frameworks do you use to test your web frontend?

    View Results

    Loading ... Loading ...
Feeds:
  • bodytext bodytext bodytext
Most popular search terms:
Stats
    Since publication, this page was visited 333 time(s).

Preconditions:

You have the public-private key pair, and use default names ~/.ssh/id_rsa.pub + ~/.ssh/id_rsa.

If your security rules allow, don’t set the passphrase. You can also remove the passphrase from already existing ssh key.

 
If they don’t, generate them:

ssh-keygen -t rsa

 
Now install the key on remote host:

cat ~/.ssh /*.pub | ssh user@remote-system 'umask 077; mkdir -p .ssh; cat >>.ssh/authorized_keys'

 
ssh user@remote-system should work now, so should scp user@remote-system:/your/file. And if you chose to have no passphrase you will login automatically

Credits:
http://www.schlittermann.de/doc/ssh

 
Does that help to solve your problem?
UN:F [1.8.5_1061]
Rating: 0 (from 0 votes)
0 votes 'YES'  0 votes 'NO'
TAGS
RELATED
Pages
Posts
    nope :(
SOCIAL
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • BlinkList
  • Blogosphere News
  • E-mail this story to a friend!
  • Furl
  • LinkArena
  • Live
  • MisterWong
  • Print this article!
  • StumbleUpon
  • Technorati
  • Webnews.de
  • YahooMyWeb

Leave a Reply

Logged in as szhszula. Log out »