4.2.4. Logging in to an instance
Prerequisites:
- Ensure that the instance’s security group has an SSH rule (see Project Security Management in the Users and Identity Management Guide).
- Ensure the instance has a floating IP address (external address) assigned to it (see 「Creating, assigning, and releasing floating IP addresses」).
- Obtain the instance’s key-pair certificate. The certificate is downloaded when the key pair is created; if you did not create the key pair yourself, ask your administrator (see 「Managing key pairs」).
To first load the key pair file into SSH, and then use ssh without naming it:
Change the permissions of the generated key-pair certificate.
chmod 600 os-key.pem
$ chmod 600 os-key.pem
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check whether
ssh-agent
is already running:ps -ef | grep ssh-agent
# ps -ef | grep ssh-agent
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If not already running, start it up with:
eval `ssh-agent`
# eval `ssh-agent`
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On your local machine, load the key-pair certificate into SSH. For example:
ssh-add ~/.ssh/os-key.pem
$ ssh-add ~/.ssh/os-key.pem
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - You can now SSH into the file with the user supplied by the image.
The following example command shows how to SSH into the Red Hat Enterprise Linux guest image with the user cloud-user
:
ssh cloud-user@192.0.2.24
$ ssh cloud-user@192.0.2.24
You can also use the certificate directly. For example:
ssh -i /myDir/os-key.pem cloud-user@192.0.2.24
$ ssh -i /myDir/os-key.pem cloud-user@192.0.2.24