To connect to a servant cPanel by means of SSH key from Mac
It describes to the process of creation of a SSH key from the Control Panel cPanel and his later installation in a Mac to initiate a remote session without making use of name of user and password.
Author: Emilio C.S.
Published the (updated )
- What we are going to do?
- He creates the SSH key in Cpanel
- Unloading and installs the key deprived in your Mac
- It accedes with your SSH key from the Terminal application
What we are going to do?We are going to create a SSH key from the Control Panel cPanel composed by private key and a public key. We will authorize the public key and later we install the key deprived in our equipment. Finally, we will initiate a remote sessi³n in the servant doing use of the SSH key.
It creates the SSH key in Cpanel
- SSH Access accedes to the Control Panel/Security/.
- It selects To administer SSH keys.
- In the new page it selects To generate a new key and it completes the form of creation of the key.
Generating one it nails public
- Name of key: id_dsa or nombredetuclave
- Password of key: a strong password
- Type of key: RSA
- Size of the key: 2048
- In order to continue it selects To generate key, if the key has been created correctly you will see the message Generation of completed key.
Generating public/private rsa key to pair.
Enter passphrase (empty for did not passphrase):
Enter same passphrase again:
Your identification you have been you know in /home/usuario/.ssh/nombredetuclave.
Your public key you have been you know in /home/usuario/.ssh/nombredetuclave.pub.
- In order to return to the administration of SSH keys it selects To return. Again in the Administration of SSH keys you will be able to verify in the section Key public that your key has been created but still she is not authorized (not authorized).
- It selects To administer and in the new Authorize page. When authorizing the key you will see the message the key nombredetuclave.pub is had authorized. In order to return to the administration of SSH keys it selects To return, you will be able to verify that the key is authorized (authorized).
Unloading and installs the key deprived in your Mac
- Beam click in Seeing/unload of the section Key private and copies
- + C your key deprived to a document without format including first (-----BEGIN RSA DEPRIVES KEY TO YOU-----) and last line (-----END RSA DEPRIVES KEY TO YOU-----).
- It opens the TexEdit application, it selects New document, it sees the menu superior Format and selects To turn to text without format or presses the keys
- T (commando + T + shift or capital letter).
- He beats
+ V your SSH key in the new document and temporarily keep it in the directory Documents from your account of user.
Mac OS X has a predetermined directory to the storage of private keys, is the hidden directory .ssh located in /Volumes/Mac/Users/Usuario/.ssh, we are going to transfer the key to that directory.
It opens the Terminal application and it executes the following commando:
mv ~/Documents/nombredetuclave ~/.ssh/
Next it assures your key with the following commando:
chmod 600 ~/.ssh/nombredetuclave
If it beams you will not receive an error as this a trying to use it:
WARNING: UNPROTECTED DEPRIVES KEY TO YOU CASES OUT!
Permissions 0644 for /Users/Usuario/Documents/nombredetuclave plows too open. It is required that your deprives key to you you case out plows NOT Accessible by others. This deprives key will sees ignored to you.
bad permissions: it ignores key: /Users/Usuario/Documents/nombredetuclave
Permission denied (publickey, gssapi-keyex, gssapi-with-mic).
- Your private key already is ready to be used as key, connects by SSH to your service of lodging Web. For it executes the following commando (where ~/.ssh/nombredetuclave is the route to your deprived key, usuary it is the name of user of your service of lodging Web and host the name of your domain or its direction IP):
ssh -2 - i ~/.ssh/nombredetuclave usuario@host
- If you need to connect to the servant through a different port you will have to specify it (1234 would be the port):
ssh -2 - p1234 - i ~/.ssh/nombredetuclave usuario@host
The first time that you establish a connection you will receive an alert as this:
The authenticity of host [host]: port ([IP]: port) can't sees established. RSA key fingerprint is. Plow does you sure you want to continues connecting (yes/no)?
It verifies that you have connected to the correct IP and accepts the authenticity of host, for it writes YES and it presses Intro.