Updated on 2022-05-09 GMT+08:00

Configuring Password-free Login to an ECS

Scenarios

This section describes how to configure an ECS to enable password-free login to it.

Background Information

$: indicates performing an operation as a common user.

#: indicates performing an operation as an administrator.

Run the sudo su command to switch from a common user to an administrator.

Prerequisites

An ECS has been created successfully and an EIP has been bound to it.

Procedure

  1. Use PuTTY and a key pair to log in to an ECS in the cluster.
  2. Run the following command to disable user logout upon system timeout:

    # TMOUT=0

  3. Copy the ECS private key file (for example *.pem) to the .ssh directory and name it as id_rsa.

    $ cd ~/.ssh

    $ mv *.pem id_rsa

  4. Run the following command to configure permissions of the key file:

    $ sudo chmod 600 id_rsa

  5. Run the following command to query the host name:

    # hostname

  6. Run the following command to add the private network IP address and name of the host:

    # vi /etc/hosts

    An example command is as follows:

    192.168.0.1 ecs-ff-0001

  7. Run the following commands to log in to the node using SSH and check whether you can log in to the ECS without a password:

    For example, if the hostname is hostname1, run the following commands:

    $ ssh localhost

    $ ssh hostname1