We all know that ssh can be make to login via ssh keys. SSH offer a secure alternative to endlessly entering a p@$$word: public key exchange.
To use public keys with an ssh server, you'll first need to generate a public/private key pair:
#ssh-keygen -t dsa
command, and then transferring the public key (
~/.ssh/id_dsa.pub) to the target machine and copy it under target machine's
.ssh folder by the name of authorized_keys.
By exchanging the keys we had just put some charge (speed) in the SSH process. So less time is spend in login so more time for troubleshooting.
But still, I am not happy
I still need to type:
#ssh server-name
to get into the server. NOW, I don't even want to type "ssh server-name" (lazy I am
)
How to achieve this?
Here is a small HACK !!!
Create a file called
ssh-to with these two lines in it (under your home):
#!/bin/bash
#ssh `basename $0` $*
Now put that in your PATH (if ~/bin doesn't exist or isn't in your PATH already, though it should be
) and set up symlinks to all of your favorite servers to it:
Make the ssh-to file executable:
#chmod 744 ~/ssh-to
Now create a directory bin under your home.
#mkdir ~/bin
Go to the bin directory and create a symbolic link, as shown:
#cd bin
#ln -s ssh-to server-name
your job is done.... now simply type "server-name" and with all the magic you will be inside the "server-name" without typing "ssh server-name"
MOST Interesting is that you can also execute some remotely without actually landing on the target server - server-name
#server-name some-command
No comments:
Post a Comment