How to Access the SSH Command Line in cPanel - Takneeki Code
Accessing the SSH Command Line in cPanel allows you to manage your website files, execute commands, and perform administrative tasks remotely. This guide will walk you through the process of using PuTTY and SSH keys to securely access your cPanel files. If you're managing a website, knowing how to use SSH can significantly improve your efficiency and control over your hosting environment.
Why Use SSH in cPanel?
Secure Shell (SSH) is a powerful protocol that enables you to remotely access your web server via a secure and encrypted connection. Using SSH, you can:
- Manage files and directories without using cPanel's file manager.
- Run scripts and execute commands efficiently.
- Perform administrative tasks like backups and database management.
- Troubleshoot and fix issues faster.
Prerequisites
Before you begin, ensure you have the following:
- A cPanel hosting account with SSH access enabled.
- PuTTY installed on your system (Download it from here).
- SSH key authentication set up in your cPanel.
Step-by-Step Guide to Access SSH in cPanel
1. Enable SSH in cPanel
- Log in to cPanel.
- Navigate to SSH Access under the Security section.
- Click Manage SSH Keys to generate a new key.
- Provide a name for the key and set a passphrase (optional but recommended).
- Click Generate Key and then Authorize the key under the Public Keys section.
- Download the private key (.ppk file) to use with PuTTY.
2. Install and Configure PuTTY
- Download and install PuTTY from the official website.
- Open PuTTYgen and load the private key (.ppk file) you downloaded from cPanel.
- Save the key again using PuTTYgen to ensure compatibility.
- Open PuTTY and enter your server’s IP address or hostname in the Host Name field.
- Set the Port to 22 (default SSH port for secure connections).
- Under Connection > SSH > Auth, browse and select your private key file (.ppk).
- Click Open to initiate the connection.
3. Log in to cPanel SSH
- When prompted, enter your cPanel username.
- If you set a passphrase for your SSH key, enter it when asked.
- Once logged in, you’ll have access to your server’s command line.
4. Using Basic SSH Commands
Now that you have access, here are some essential SSH commands to manage your server:
ls
– List files in the current directory.cd foldername
– Change directory.pwd
– Show the current directory.rm filename
– Delete a file.mkdir foldername
– Create a new folder.nano filename
– Edit a file using the Nano text editor.
5. Additional SSH Tips
- Transferring Files Securely: Use
scp
(secure copy) orrsync
to move files between your local system and server. - Checking Server Load: Use
top
orhtop
to monitor your server's performance. - Restarting Services: If you have root access, restart Apache (
sudo systemctl restart apache2
) or MySQL (sudo systemctl restart mysql
).
Watch the Tutorial Video
For a detailed visual guide, watch our YouTube video: How to Access SSH in cPanel.
Conclusion
By following this guide, you now have a secure way to access and manage your cPanel files using SSH and PuTTY. This method gives you greater control, efficiency, and security over your web hosting environment.
Join the Community
Have any questions? Join our Facebook community: Takneeki Code and share your experience!
Thanks for reading and happy coding! 🚀
Comments
Post a Comment
Thanks for Visit.