Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.


Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Universal configuration monitoring and system of record for IT.
Hide

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:

Hide

News

May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!
Hide

Top Tags

Hide

Functions

Psst. Open beta.

Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:

  • » The open beta is running a copy of the database that will not carry over to the final version. Don't post anything you don't mind losing.
  • » If you wish to use your user account, you will probably need to reset your password.
Your feedback is appreciated via the form on the beta page. Thanks! -Jon & CLFU Team

Transfer SSH public key to another machine in one step

Terminal - Transfer SSH public key to another machine in one step
ssh-keygen; ssh-copy-id [email protected]; ssh [email protected]
2009-03-18 07:59:33
User: bwoodacre
Functions: ssh ssh-keygen
20
Transfer SSH public key to another machine in one step

This command sequence allows simple setup of (gasp!) password-less SSH logins. Be careful, as if you already have an SSH keypair in your ~/.ssh directory on the local machine, there is a possibility ssh-keygen may overwrite them. ssh-copy-id copies the public key to the remote host and appends it to the remote account's ~/.ssh/authorized_keys file. When trying ssh, if you used no passphrase for your key, the remote shell appears soon after invoking ssh [email protected]

Alternatives

There are 3 alternatives - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

yes, but you missed some params in ssh-keygen for passwordless prompt nothing.

ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 2048 -P
Comment by starchox 402 weeks and 2 days ago

@starchox you have specified the default values for the -t -f and -b options so they aren't necessary assuming a recent ssh-keygen. To truly get everything to run unattended (which probably isn't a "best practice") without a passphrase, try

ssh-keygen -P ''; ssh-copy-id -i ~/.ssh/id_rsa [email protected]; ssh [email protected]

that's two single quotes after the -P setting the passphrase to an empty string which I believe should be the same as no passphrase at all.

Comment by bwoodacre 396 weeks and 4 days ago

I think what starchox was trying to say it that in order to be not prompted at all you have to specify everything his command did; and more, actually...

ssh-keygen -P '' -f ~/.ssh/id_rsa -b 2048

...will not ask you for a thing.

@bwoodacre:

your second command doesn't need the -i in it, that is the default (and without prompt)

So, for most of you out there, if you are doing this on a new machine or machine that otherwise needs a new key to be written, your command for doing everything you need (without a passphrase) on one line is:

ssh-keygen -P '' -f ~/.ssh/id_rsa -b 2048; ssh-copy-id [email protected]; ssh [email protected]

...ssh [email protected] is obviously only for logging in when done

...and most systems don't prompt for the -b (bits) and default to 2048

:)

Comment by sudopeople 392 weeks and 2 days ago

http://goo.gl/TLJKhQ http://bit.ly/2bgLGS7 jasa konstruksi bangunan

http://goo.gl/TLJKhQ http://bit.ly/2bgLGS7 jasa konstruksi baja wf

http://goo.gl/TLJKhQ http://bit.ly/2bgLGS7 jasa konsultan konstruksi

ss

Comment by umam12 6 weeks and 4 days ago

http://goo.gl/zhFEpe http://bit.ly/2bF0zgB Daftar Harga Besi Pipa Baja Schedule 40 Dari Distributor Pabrik

http://goo.gl/AfxmL4 http://bit.ly/2c5pYC8 Daftar Harga Besi Pipa Baja Schedule 80 Dari Distributor Pabrik

fg

Comment by umam12 6 weeks and 4 days ago

http://bit.ly/1P41Awa https://goo.gl/L1t3uj undangan pernikahan undangan pernikahan unik dan murah

http://bit.ly/1P41Awa https://goo.gl/L1t3uj undangan pernikahan artis undangan pernikahan elegan dan murah

dss

Comment by umam12 6 weeks and 4 days ago

Your point of view

You must be signed in to comment.