Although you have exchanged public keys with your remote server to avoid that boring bit of entering your super long secure user password everytime you are about to login, you still need to face ssh syntax in order get someting done. Yes, it is just single line command with few words but typing that line 30 times a day can take you at least 10 minutes of problem solving time, bore you and more iportatbly it may even give you a headache. This article outlines two alternative options on how to make ssh login procedure easier and thus keeping you sane longer.
Create an alias by editing .bashrc file
Let's create a ssh alias which allows us to ssh login to remote server ( example: linuxconfig.org on port 2222 ) with a single command. Open .bashrc file with your favourite text editor and append a folloiwng line:
alias lconfig='ssh -p 2222 linuxconfig.org'
Your new alias will be activated when you create a new shell session. Therefore, open up new terminal ( or logout and login ) and enter lconfig command to login to your remote server. If you have successfuly exchanged your public keys with a remote server you should be able login to your remote server in no time.
Create a symlink to ssh custom ssh script
Second option is little bit more tricky but at the same time it also allows us to execute any commands on a remote server directly from local shell. First, create a bash script with following two lines:
#/bin/bash ssh `basename __g5_token5ade09d577886` $*
Login as a root make this script executable and copy this script into /usr/local/bin directory:
# chmod +x /tmp/ssh-autologin.sh # cp /tmp/ssh-autologin.sh /usr/local/bin/
Now, create a symbolic link to your script where the name of your new symbolic link will be an IP address or hostname of your remote server:
# ln -s /usr/local/bin/ssh-autologin.sh /usr/local/bin/linuxconfig.org
or create IP address symlink:
# ln -s /usr/local/bin/ssh-autologin.sh /usr/local/bin/22.214.171.124
Ensure that /usr/local/bin directory is in your PATH by:
$ echo $PATH
If you need to add /usr/local/bin directory to your path follow this simple ENV PATH how to. All set and ready. To login to your remote server simply enter command:
To see who is online on your remote server with an IP 126.96.36.199 without actual ssh login enter:
$ 188.8.131.52 who
The command above will create ssh connection, execute "who" command on a remote server, print the output on your local terminal and logout.