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

By neokrates, written on November 26, 2010

Bash   snippet

  • Join date: 11-30-99
  • Posts: 224
View Counter:
  • 339 views
Rate it
Ad
Poll
  • How would you prefer to migrate to new technology?

    View Results

    Loading ... Loading ...
Feeds:
  • bodytext bodytext bodytext

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

Be Sociable, Share!
 
Does that help to solve your problem?
VN:F [1.8.5_1061]
Rating: 0 (from 0 votes)
0 votes 'YES'  0 votes 'NO'
TAGS
RELATED
Pages
Posts
SOCIAL
Be Sociable, Share!

Leave a Reply