Intro ssh-argv0...
ssh-argv0 is a simple wrapper that runs ssh and appends the current program name (as well as any arguments). It's installed as a part of the openssh-client package. Using it is pretty straightforward. Just make a sim-link called the hostname of the server you frequently connect to. Be sure to point it towards ssh-argv0
sudo ln -sf /usr/bin/ssh-argv0 /usr/local/bin/boomer.riley
Now you can simply call the sim-link to connect. You've got tab completion and it saves you a whole 4 keystrokes!
boomer.riley echo 'Just saved some time connecting to $HOSTNAME' mriley@boomer.riley's password: Just saved some time connecting to boomer
Instead of passing the login_name argument, you can roll that into the sim-link you create as well.
sudo ln -sf /usr/bin/ssh-argv0 /usr/local/bin/totallynotroot@boomer.riley totallynotroot@boomer.riley totallynotroot@boomer.riley's password:
Maybe you've got a lot of machines and you'd like to programmatically create a bunch of these. You can do that...
Good question. You've probably wasted more time reading this post than you'll ever get back with this trick... mwahahaha.
for i in {1..50}; do sudo ln -sf /usr/bin/ssh-argv0 /usr/local/bin/host$i.riley; doneMatt, that's just crazy. What will I do with all the time I've saved with this trick?
Good question. You've probably wasted more time reading this post than you'll ever get back with this trick... mwahahaha.
~MJ
2 comments:
Yeah, I would spend my time creating proper ssh keys so you don't need to enter that password. And Gabe recommended Gas Mask as a simple quick etc hosts editor which has been super handy. Though a combination of all of these and you could type like a couple characters to connect!
But.... surely you're encrypting your ssh key, right? :-P
In reality I just use bash aliases for single-character connect commands.
Post a Comment