Use ITerm2 to connect SSH quickly

Source: Internet
Author: User

Everyone knows to use the ITerm2 connection shh use the command SSH-P22 [email protected], and then enter the password.

But it's still a bit cumbersome to enter every time. ITERM2 provides a quick way for us. Three steps to complete this setting. Here's how:

1, Edit command text

Sample:

[Plain]View PlainCopy 
    1. #!/usr/bin/expect-f
    2. Set User root
    3. Set Host 172.16.10.71
    4. Set Password mima123456
    5. Set Timeout-1
    6. Spawn ssh [email protected] $host
    7. Expect "*assword:*"
    8. Send "$password \ r"
    9. Interact
    10. Expect EOF

According to this sample, write a text file to be saved in one place.

The port number is not specified in this sample and is using SSH default port 22

If it is a different port number, you can modify it as follows

[Plain]View PlainCopy 
    1. #!/usr/bin/expect-f
    2. Set Port 2121
    3. Set User root
    4. Set Host 172.16.10.71
    5. Set Password mima123456
    6. Set Timeout-1
    7. Spawn Ssh-p$port [email protected] $host
    8. Expect "*assword:*"
    9. Send "$password \ r"
    10. Interact
    11. Expect EOF


Syntax Description: The above set is the definition variable

The spawn below is the call command, which uses the above defined variables in the command

2, set invoke command

ITerm--Preferences open the Settings screen

Click the lower left corner + add a shortcut,

Select Commond on the right and enter the address of the command file in the input box

Give the shortcut a name above the right.

This completes the setup of the shortcut.

3, using shortcuts

Start ITerm2 software, will pop up a selection of shortcut interface, select the pre-built shortcuts can be;

Already opened ITerm2, right-click on the Software icon and select New Table to see the pre-built shortcuts.

Use ITerm2 to connect SSH quickly

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.