Item2 connect to SSH

On the MocOS system, there is no xshell, and among some tools similar to xshell, the easy-to-use tools need to be charged, and the free ones are not easy to use, so I decided to use iTerm2 to create a useful ssh artifact.

1. Create a new Profile

Switch to the Profiles management page on the configuration management page:

 

 

Second, configure the ssh connection 

1. Configure ssh connection information


  

  1. The Name area is the configuration profile name.
  2. Select the Command option in the Command area and configure the ssh connection command. The password configuration will be described in detail below.
  3. The Tags area is tags, and multi-level tags are separated by "/". When there are many Profiles, you can locate the target Profile faster by filtering by tags.

2. View the tag tree

Click the Tags button to view the tag tree: 

 

 

3. Configure password

After configuring the ssh connection, every time you open the profile, you will directly execute the ssh command to connect to the remote server, and then require manual input of the password.
If you want to autofill passwords, you need to use Triggers. Triggers will monitor the output text of the terminal seesion, and if the text matches a regular expression, the action corresponding to the regular expression will be executed.
Configure the regular expression in Triggers to match the prompt text of the input password, and then trigger the input of the password text or pop up the password manager to realize the function of automatically filling the password or selecting a password from the password manager.
Continue to edit Profile and open the advanced configuration:

Add a rule to automatically enter the password: 

 

The regular expression "(P|p)ass(word|wd):" of the above rule can match the prompt text for entering the password, and then trigger the action "Send Text", which will send the text configured in Paramters to the terminal session In , the function of automatically filling passwords is realized.
Send Text automatically enters the password, you need to add a carriage return (\r) or line feed (\n) at the end of the password text, so that you can directly connect to the remote service, otherwise you need to manually press the Enter key to connect to the remote server .

 

Guess you like

Origin blog.csdn.net/summer_fish/article/details/131973536