SSH Login to VPS using Linux terminal

Source: Internet
Author: User
Tags vps vps server ssh config ssh config file

Windows Remote SSH Login VPS to manage the weapon is PuTTY, but there is no need for Linux to use it. Linux, Unix (including Mac IOS) must have a built-in command-line terminal, built-in OpenSSH instructions. It is more convenient to log on to the Linux system on the VPS.

Open the command line terminal in Linux, enter the instructions directly,

ssh <username>@<serverdomain or ip>-P <port>

You will be prompted to enter a password to log in. You can also use the graphical interface, and if the server supports it, add the parameter-X.

With the characteristics of Terminal, PuTTY seems to be of little use. For added convenience, you can also configure config for local SSH to simplify the command input.

Create an SSH config file,

Touch ~/. ssh/config

Typically, this represents the root user directory of the current system user, so this file may be (depends on the system you are /home/username/.ssh/config using).

Now enter the configuration, such as the example above, the user name is Username,vps server is server_ip, the server SSH service port is 4321, then,

cat >> ~/. ssh/config <<eofhost your_alias    User    username Hostnameserver_ip4321 EOF

Here your_alias can be any alias you want, such as Myvps. Now it's easy to enter directly,

ssh Your_alias

To log in to the VPS. The first instruction is the same as the previous one.

You can also add some other features to this configuration, such as connection hold. Want to let it automatically at a certain time (such as 30 seconds) when we do not operate to send meaningless data to keep the connection is not disconnected by the server,

Cat " Serveraliveinterval " >> ~/. ssh/config

Thus, when we do not operate, Terminal will send the data every 30s to keep the connection until we exit ourselves.

If you have more than one server, you can add another HOST, for example,

cat >> ~/. ssh/config <<eofhost myvps    User me    Hostname myvps_ip    4321      EOF

Above the Host declaration before the empty line to separate from the previous configuration, mainly to check the config file back when looking good:D

SSH Config also has a lot of parameters, you can refer to the OpenSSH documentation. ©

SSH Login to VPS using Linux terminal

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.