Conclusion

Planning to launch your B2B website? Baffled by the options and the claims made by all the solution providers you have considered? Wondering how to find the differentiating factor between an average…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




automatic ssh connection without password

I have been using SSH connection often, but typing passwords just makes me exhausted especially when typing the wrong password. So I have found some solutions to remote SSH without a password.

Most often using SSH without a password will use the public and private keys method, but in this post, I am not going to use this method. I have written a post on SSH public and private tutorials in this post . In this article I will cover bleow topic:

I am going to introduce sshpass this package, but before it I want to mention another command to ignore or skip fingerprint option.

Command to do ssh connection: ssh username@host or IP , if you make ssh connection it will occur fingerprint, you can press yes, or ignore it. I am going to teach you how to skip the fingerprint option.

In order to skip displaying this option we can use this command it will not show : ssh -o StrictHostKeyChecking=no <username>@<host or IP address>

The sshpass the command is pretty powerful, it allows us to connect ssh without enter a password. So we need to install the package first.

There are two options:

Let's give some examples:

Please create a filename (sshpasswd). So you don’t have to show your password in the command line, which is much more secure.

We can combine both sshpassand StrictHostKeyChecking together using the below command

We can use both commands to remote ssh and we can also add some commands:

You will be asking why am I introducing gnome-terminal. Well, this is a useful tool that will automate opening a new terminal or new tab terminal. This is a pretty useful tool when doing automation.

In this section,I will explain the basic command for gnome-terminal.

Under Ubuntu gnome-terminal default is already installed, so in order to open a new terminal just type in this command: gnome-terminal it will pop a new terminal or use gnome-terminal --tab to open a new tab terminal

Note: we need to add exec bash in the end, else will not pop new terminal

gnome command with ssh commands:

Now we have a fundamental of using ssspass, and gnome-terminal these two commands, we now are able to use automation to implement them. I am using bash automation as an example.

This is an example of running iperf3 server with 7 different IP addresses with a new terminal.

I use localhost or 127.0.0.1 as an example, which is remote to my local PC.

So in this post, I have mentioned usingsshpass method to ssh connection without a password, but you can use another method public and private key, which I mention in another post. I also mention how to use gnome-terminal which is pretty useful.

I have been writing automation on it, looking at many tutorials, and wishing to share it with people. Hope this blog might help people if you have many ssh to connect and hate to enter long complicated passwords.

Lastly, If you're interested in more commands, I have listed many related references on both Iperf and gnome-terminal.

Add a comment

Related posts:

If Only Production Incidents Could Speak

Below are the slides and extended speaker notes from my talk on July 18, 2019, at OSCON 2019 with the same title as this post. See my prior posts for related material:

Lost at Sea

Mood going up and down like waves in an ocean. “Lost at Sea” is published by untiLTD.

Why Facebook is hiring a lot more data scientists

Today my guest is Akhil Reddy, a Senior Data Analyst at Autodesk, formerly Data Analyst at ZipRecruiter, and Data Engineer at PayPal. Akhil shared tips on how to look for a technical job during the…