preface

We all know that macOS comes with a powerful Terminal, but sometimes it is not convenient to save passwords when using SSH commands to connect to remote servers, so we need to find a better Terminal tool — iTerm2.

iTerm2 is a terminal emulator for macOS that does amazing things.

Download and install iTerm2 from the iTerm2 website. The default Settings are as follows:

Save the password

In fact, iTerm2 comes with Password Manager functionality, but after saving, you need to manually select the Password when connecting to the server, which I think is not very convenient. If you want to set it up this way, refer to the following article.

How to ssh iTerm2 with password manager

Let’s look at another way to save your password

The new file

$ mkdir iterm2_ssh
$ cd iterm2_ssh/
$ touch server-online
$ vim server-online 
Copy the code

The name of the file I created is server-online, which indicates that I want to log in to the online server. Of course, you can not use the command above, directly create a new folder in a folder, and then write the following content to the file.

set user ubuntu
setThe host 62.234.16.210set password ******

spawn ssh $user@$host
expect "*assword:*"
send "$password\r"
interact
expect eof
Copy the code
  • Ubuntu indicates the user name to log in to the server
  • 62.234.16.210 indicates the IP address for logging in to the server
  • ****** indicates the password for logging in to the server

The specified directory

Select Profiles — Open Profiles — Edit Profiles

Select Command in the Command option and specify the file we just set up

The login

To log in, select Profiles and then Server-Online.

Of course, we can also set multiple, configure different files.

More recommended

Nginx getting started

Word cloud generation application based on Flask and Vue

How to use Hexo to have a small station of your own

To learn more, please pay attention to the official number: nine o ‘clock off work