Learn how to access your cPanel, WHM, and Webmail interfaces securely using various methods, including web browsers, SSH clients, and in-browser terminal applications. Follow step-by-step instructions to log in to your hosting account and manage your server resources effectively.
Discover multiple methods for accessing your cPanel, WHM, and Webmail interfaces to manage your hosting account efficiently. Whether you prefer web-based access or a command-line interface (CLI), this tutorial provides detailed instructions for seamless login and navigation.
Imagine your website as a thriving kingdom. cPanel acts as your command center, granting you control over various aspects like file management, security settings, and email accounts. Conversely, Webmail is your dedicated post office, allowing you to manage emails seamlessly.
Now, if you've been entrusted with managing multiple cPanel accounts, WHM emerges as your royal scepter. It grants you the power to create and manage these cPanel accounts, acting as an administrative hub.
Key Differences
Feature |
cPanel |
WHM |
Webmail
|
---|---|---|---|
Access Level
|
User | Administrator and Resellers | User |
Primary Function
|
Manage a single website | Manage multiple cPanel accounts | Manage website email |
Access Port
|
2083 | 2087 | 2096 |
Why Grant Access?
As your website flourishes, you might need to delegate tasks. Here's where Team Management within cPanel comes in handy. It allows you to grant secure access to specific areas of your cPanel account, empowering collaborators (developers, content creators, or marketing specialists) to work alongside you.
Sub-accounts have been deprecated in favor of Team Management, offering a more secure and granular approach to access control.
Acquiring a cPanel Account:
- To access cPanel services, you must first purchase a cPanel hosting package from WebHostingM.
- Follow the prompts during the package configuration process to select your preferred server region and complete the purchase.
- Upon provisioning, you'll receive essential credentials, including server hostname, IP address, cPanel username, and password.
Understanding cPanel Service URLs:
- A typical cPanel service URL consists of four sections: Protocol, Address, Port number, and Security token.
- The Protocol (https://) ensures secure communication between your browser and the remote server.
- The Address represents either an IP address or a domain name, indicating the remote server you wish to access.
- Port numbers (2083, 2087, 2096, etc.) specify the specific cPanel, WHM, or Webmail service.
- Security tokens (cpsess1234567890) prevent unauthorized access through XSRF attacks.
Web-Based cPanel Login:
- Access cPanel via web browsers using the secure port (2083) with your server hostname, domain name, or IP address.
- Prefer using domain names or server hostnames to avoid browser warnings.
- Example URLs include:
- https://123.456.789.101:2083 (where "123.456.789.101" is the IP of the server hosting your cPanel account (not recommended on account that this will probably not a secure access))
- https://webserver.cpanelcontrolpanel.com:2083 (where "webserver.cpanelcontrolpanel.com" is the name of the server hosting your cPanel account)
- https://example-domain_name.com:2083
- https://cpanel.example-domain_name.com (where "example-domain_name.com" is your domain name)
- Utilize two-factor authentication (2FA) if enabled for additional security.
Using SSH
Whether you're a complete beginner or a seasoned developer, understanding SSH can unlock a new level of control over your online presence.
What is SSH?
Imagine SSH as a secure tunnel that allows you to remotely access and manage your website's files and configurations directly on the server. It's like having a digital key that grants you exclusive entry to a virtual room filled with all the behind-the-scenes workings of your website. Unlike traditional file transfer methods (FTP), SSH encrypts your communication, adding an extra layer of security to your data transfer.
Why Use SSH?
There are several scenarios where SSH comes in handy:
- Direct File Management: Need to edit website configuration files or upload custom scripts? SSH provides a terminal-based interface for navigating directories, creating files, and performing various file management tasks directly on the server.
- Advanced Troubleshooting: Encountering server-side errors or configuration issues? SSH allows you to access server logs and run diagnostic commands, aiding in troubleshooting complex website problems.
- Cron Jobs & Automation: Want to schedule automated tasks on your server, like backups or script execution? SSH access empowers you to set up cron jobs, which are automated commands that run at specific times or intervals.
- Increased Security (Advanced): While WebHostingM's cPanel provides a user-friendly interface for many tasks, SSH offers a more granular level of control for security-conscious users. You can manage user accounts, adjust file permissions, and implement advanced security measures directly on the server.
Accessing Your Web Server with SSH (Intermediate & Advanced)
Important Note: While SSH offers advantages, it's recommended for users comfortable with a command-line environment. If you're a beginner, consider exploring cPanel's File Manager and other user-friendly tools before venturing into SSH.
Prerequisites:
- An SSH client: Popular options include PuTTY (Windows) or the built-in terminal applications on macOS and Linux.
- Your WebHostingM server's hostname or IP address.
- Your cPanel username and password.
How To Verify Existing SSH Keys on Your Local Machine
Before generating a new SSH key pair, it's wise to check if you already have one on your local machine. Here's how:
1. Open your terminal application.
- MacOS: Use the keyboard shortcut
Command + Space
, then search for "Terminal." Alternatively, navigate to Applications > Utilities > Terminal. - Linux: The location of the "Super" key might vary depending on your distribution. For example, on Pop!_OS, it's located between the "Fn" and "Alt" keys. Use the appropriate key combination to launch the terminal.
2. Identify Existing Keys:
Once the terminal is open, run the following command:
ls -al ~/.ssh
- This command lists all files and directories within the hidden
~/.ssh
directory, which is the standard location for SSH key management on your machine.
3. Interpreting the Output:
- If the command returns an output with file listings, it indicates the presence of SSH keys within your
~/.ssh
directory. - Look for files ending in
.pub
. These represent the public keys used for authentication. Common filenames for supported public keys include:id_rsa.pub
id_ecdsa.pub
id_ed25519.pub
4. Key Pair Availability:
- If you see existing public key files, you likely have a corresponding private key pair stored within the same directory. You can potentially use these existing keys for SSH access if they are compatible with your cPanel server.
- If the command returns "ls: cannot access '~/.ssh': No such file or directory," it signifies the absence of an existing SSH key pair on your local machine.
5. Next Steps:
- If you don't have existing keys or want to generate a new pair, you can proceed with creating a new SSH key pair using the
ssh-keygen
command. - If you find existing keys you want to utilize, consider adding them to the
ssh-agent
for easier access during SSH sessions.
How To Generate a new SSH key
It would be best if you generated a new SSH key on your local machine.
After you generate the key, you can add the public key to your account on cPanel to enable authentication for operations over SSH.
But before that, let's understand the command we are running especially the key we wish to is:
SSH Key Types
Key Type | Description | Advantages | Disadvantages |
---|---|---|---|
DSA (Digital Signature Algorithm)
|
An older SSH key type using 1024-bit keys. | Widely supported by older servers. | Considered less secure than newer options due to smaller key size and potential vulnerabilities. |
RSA (Rivest–Shamir–Adleman) (ssh-rsa)
|
The most common SSH key type, using 2048-bit keys or higher. | Well-established and widely supported. | Slightly slower than ed25519 for signing operations. |
ed25519
|
A newer, elliptic curve cryptography-based SSH key type. | Faster and considered more secure than DSA and RSA for equivalent key strengths. | May not be supported by all legacy servers. |
Additional Notes:
- Key size refers to the length of a cryptographic key, which impacts security. Larger key sizes generally provide stronger encryption.
- Elliptic curve cryptography offers advantages in terms of performance and security compared to traditional algorithms like RSA for similar key sizes.
- While DSA keys are still functional, it's recommended to use RSA or ed25519 keys for new SSH key generation due to their improved security.
Still on the Terminal.
Paste the text below, replacing the email used in the example with your cPanel email address.
ssh-keygen -t ed25519 -C "device-name OR email[at]example-domain.com"
When you're prompted to "Enter a file in which to save the key", you can press Enter to accept the default file location.
Please note that if you created SSH keys previously, ssh-keygen may ask you to rewrite another key, in which case it is recommended creating a custom-named SSH key or a customer location to save the key.
To do so, type the default file location and replace id_ALGORITHM with your custom key name.
At the prompt, type a secure passphrase if you need to use a passphrase (recommended).
Working with SSH key passphrases
With SSH keys, if someone gains access to your computer, the attacker can gain access to every system that uses that key. To add an extra layer of security, you can add a passphrase to your SSH key. To avoid entering the passphrase every time you connect, you can securely save your passphrase in the SSH agent.
You can change the passphrase for an existing private key without regenerating the keypair by typing the following command:
Requirements:
- Your existing private key file (usually located at
~/.ssh/id_rsa
by default, but the filename can vary). - You'll need to know the current passphrase for the private key.
-
Open your terminal application.
-
Run the following command, replacing
[current_passphrase]
with your current passphrase and[filename]
with the actual filename of your private key (if different fromid_rsa
):
ssh-keygen -p -P [current_passphrase] -f ~/.ssh/id_ed25519
Explanation:
ssh-keygen
: This is the command used to manage SSH keys.-p
: This flag tellsssh-keygen
to change the passphrase of an existing key pair.-P [current_passphrase]
: This option specifies the current passphrase for the private key.-f [filename]
: This option specifies the filename of the private key you want to modify.
-
Press Enter.
-
You will be prompted to enter the new passphrase for your private key. Type your desired new passphrase and press Enter.
-
Re-enter the new passphrase for confirmation. Type it again exactly and press Enter.
Success! Your private key's passphrase has been successfully changed. The existing private key file will be overwritten with the new passphrase.
Important Notes:
- Make sure you remember your new passphrase! Losing your new passphrase will render your private key unusable. Consider using a password manager to securely store your passphrase.
- Back up your private key before making any changes. This way, you can restore it if something goes wrong during the process. You can create a backup by copying the private key file to a safe location.
- This process only changes the passphrase for the private key file. The corresponding public key file remains unchanged.
How To Add your SSH key to the ssh-agent on Linux
If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_ed25519 in the command with the name of your private key file.
ssh-add ~/.ssh/id_ed25519
How To Add your SSH key to the ssh-agent on macOS
Before adding a new SSH key to the SSH agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key.
Start the ssh-agent in the background:
eval "$(ssh-agent -s)"
Depending on your environment, you may need to use a different command.
For example, you may need to use root access by running sudo -s -H before starting the ssh-agent, or you may need to use exec ssh-agent bash or exec ssh-agent zsh to run the ssh-agent.
If you're using macOS, modify your ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain.
First, check to see if your ~/.ssh/config file exists in the default location.
open ~/.ssh/config
If the file doesn't exist, create the file.
touch ~/.ssh/config
Open your ~/.ssh/config file, then modify the file to contain the following lines.
If your SSH key file has a different name or path than the example code, modify the filename or path to match your current setup.
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes
Host domain #this is what you want to use as the name for this login
HostName example-domain.com # IP address
User example # this is your cPnel username
Port 22
PreferredAuthentications publickey
How To Add a new SSH key to your cPanel account
Now that you have created your brand new SSH key, you can add the SSH key to your cPanel server to use it for authentication.
There are three common methods to copy the SSH id_ed25519.pub public key to your clipboard in Linux:
Common Methods to Copy SSH id_ed25519.pub Public Key to Clipboard in Linux
Here are some common methods to copy your SSH id_ed25519.pub public key to the clipboard in Linux:
1. Using cat
and redirection:
This method uses the cat
command to display the contents of the file and redirect the output to the clipboard using redirection.
cat ~/.ssh/id_ed25519.pub | clip # Clipboards like xclip or wl-copy are assumed
2. Using xclip
or wl-copy
(if available):
These commands directly copy the contents of a file to the clipboard. They might not be pre-installed on all systems.
xclip -i ~/.ssh/id_ed25519.pub # For xclip clipboard manager
wl-copy ~/.ssh/id_ed25519.pub # For wl-copy clipboard manager
3. Using a visual editor with copy functionality:
You can open the id_ed25519.pub
file in a text editor like nano
or vim
. Then, use the editor's built-in copy functionality to copy the key content.
nano | vi ~/.ssh/id_ed25519.pub # Open in nano editor
Once the file is open, find the "copy" option within the editor's menu or use keyboard shortcuts (often Ctrl+C) to copy the highlighted text.
4. Using a graphical file manager (if available):
Some graphical file managers allow you to right-click on the id_ed25519.pub
file and select a "Copy" option to copy its contents.
Important Note:
- Replace
clip
,xclip
, orwl-copy
with the specific clipboard manager you're using on your system. These are just examples. Check your system's documentation for available clipboard managers. - Make sure you don't share your private SSH key with anyone. The
id_ed25519.pub
file contains your public key, which is safe to share for authorization purposes.
If your SSH public key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don't add any newlines or whitespace.
Common Methods to Copy SSH id_ed25519.pub Public Key to Clipboard in macOS
Here are all the common methods to copy your SSH id_ed25519.pub public key to the clipboard on macOS:
1. Using cat
and pbcopy
:
This method combines the cat
command to display the file contents and pbcopy
to copy the output to the clipboard.
cat ~/.ssh/id_ed25519.pub | pbcopy
2. Using pbcopy
directly:
This method leverages pbcopy
to directly copy the file content.
pbcopy < ~/.ssh/id_ed25519.pub
It is recommended to create an alias
for this so that you can use something like: pb
:
vi .bash_aliases
alias pb="cat ~/.ssh/id_ed25519.pub | pbcopy"
source .bash_aliases
Important Notes:
- Replace
your_username
in the third method with your actual username used for SSH authentication. - Make sure you have the
id_ed25519.pub
file present in the standard location~/.ssh/
. If you haven't generated your SSH key pair yet, you can do so using thessh-keygen
command in your terminal. - The third method assumes you've previously added your SSH key to the macOS Keychain for easier access.
Additional Methods:
- Using a text editor with copy functionality: Open the
id_ed25519.pub
file in an editor like TextEdit or Sublime Text and use the editor's built-in "copy" function. - Using a graphical file manager: Right-click on the
id_ed25519.pub
file in Finder and select "Copy" from the context menu (if available).
Remember, these methods all achieve the same goal of copying your SSH public key to the clipboard for pasting it elsewhere, like adding it to a server's authorized_keys file. Choose the method that best suits your workflow and comfort level.
Time To The Key To Your cPanel Server
Here's a more professional rephrasing of the instructions:
Adding Your Public Key to the Remote Server
Once you've copied your public key to your clipboard, you'll need to add it to your cPanel account on the remote server. This grants you SSH access without requiring a password for each login. There are two primary methods to achieve this:
Method 1: Using cPanel's SSH Access Interface
- Log in to your cPanel account.
- Navigate to the Security section and select SSH Access.
- Click on Manage SSH Keys.
- Click on Import Key.
- Optional: Customize the key name in the text box. This helps differentiate between multiple keys and ensures you're adding the intended key.
- Note: While the default name is
id_dsa
, consider using a more descriptive name. - Security Note: DSA keys, commonly used in older SSH versions, are still supported but discouraged due to security concerns. Opt for stronger alternatives like RSA or ed25519.
- Note: While the default name is
- Paste the previously copied public key into the designated text box.
- Click Import.
Method 2: Manual Addition to authorized_keys
File (Advanced Users)
For advanced users, you can manually add the public key to the authorized_keys
file located in the remote user's home directory (~/.ssh
). This method requires direct SSH access to the server and involves editing the file with appropriate permissions.
Authorization
Regardless of the chosen method, newly imported keys require authorization before use.
- Locate the Authorization Status section for the imported key.
- If the status is not already "authorized," click the Authorize button to activate the key for SSH login.
By following these steps, you've successfully added your public key to your cPanel account, enabling secure and passwordless SSH access to the remote server.
How To Test your SSH connection
Before connecting, ensure you have your:
- Username: Your cPanel username.
- Server IP Address: The unique address assigned to your server.
- Passphrase (Optional): If you've set up an SSH key pair with a passphrase for the key you created earlier, you'll need it for authentication.
Connecting via Terminal:
-
Open your terminal application. This is usually found in Applications > Utilities > Terminal (MacOS) or Start menu > Search for "Command Prompt" or "Terminal" (Windows).
-
Run the following command, replacing the placeholders:
ssh username@123.456.789.01
- Replace
username
with your cPanel username. - Replace
123.456.789.01
with your server's actual IP address.
Custom SSH Port:
If your server uses a non-standard SSH port (default is port 22), use this format:
ssh -p port_number username@123.456.789.01
- Replace
port_number
with the custom port your server uses. For example, it could be "4555" or something else.
Authentication Prompt:
- SSH Key with Passphrase: If you've set up an SSH key pair with a passphrase, you'll be prompted to enter the passphrase before continuing.
- Password: If you haven't set up an SSH key, you'll be prompted to enter your cPanel password. If you are hosting your website or application on WebHostingM, you are not likely to succeed with this as password authentication is not permitted on our systems.
Successful Connection:
If your credentials are correct, you'll be connected to your server's terminal.
Don't Be A Cautionary Note:
Remember, with great power comes great responsibility. Exercise caution when wielding CLI commands, as they wield the power to impact server operations. For deeper insights into SSH capabilities, explore:
man ssh
info ssh
WebHostingM Support Is Here to Help!
Remember: If you encounter any issues or have questions about cPanel login credentials or resetting your password, submit a ticket. Our friendly engineers will be happy to help you resolve any challenges you may face.
Not a WebHostingM customer yet, but curious about reselling cPanel? WebHostingM offers fantastic cPanel reseller hosting plans – check them out at our cPanel Marketplace and unlock a world of website management possibilities!