Script for ssh automatic login to a specific port
6,161
For automatic login, the way to go is using key-based authentication.
A nice tutorial here
You can then use the default one (the one in the ~/.ssh/id_rsa
) or use another key passing -i MyKeyFile
parameter to ssh.
Related videos on Youtube
Author by
sam
Updated on September 18, 2022Comments
-
sam over 1 year
So currently, the "traditional" way to connect through SSH is the following one:
ssh USERNAME@HOST -p PORT
I would like to create a script in which I will include all the appropriate information (username, password, host, port) and when I run it, it will connect automatically leading me to the shell of the host machine.
I don't care about the language you will use (e.g. Python, Perl...). I have tried to create it using Expect but unfortunately it didn't work for me.
-
lese over 8 yearsis for your self? create a bashrc alias
-
smw over 8 yearsA better option might be to use the user's
~/.ssh/config
file + key-based authentication -
lese over 8 yearsyou are right, I didn't think about it
-