{"id":15318,"date":"2025-03-03T14:30:07","date_gmt":"2025-03-03T14:30:07","guid":{"rendered":"https:\/\/www.20i.com\/blog\/?p=15318"},"modified":"2026-02-20T09:40:38","modified_gmt":"2026-02-20T09:40:38","slug":"getting-started-with-managing-your-wordpress-website-using-ssh","status":"publish","type":"post","link":"https:\/\/www.20i.com\/blog\/getting-started-with-managing-your-wordpress-website-using-ssh\/","title":{"rendered":"Getting Started with managing your WordPress website using SSH\u00a0"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p>SSH (Secure Shell) provides a secure and efficient way to access your hosting or server environment. It allows you to manage website files, execute commands, and interact with your database seamlessly.&nbsp;&nbsp;<\/p>\n\n\n\n<p>With SSH, the connection to your filesystem remains encrypted and protects sensitive data from interception, including threats such as <a href=\"https:\/\/www.swcrc.police.uk\/post\/what-is-a-man-in-the-middle-attack\" target=\"_blank\" rel=\"noreferrer noopener\">Man In The Middle attacks<\/a>, and unauthorised access.&nbsp;&nbsp;<\/p>\n\n\n\n<p>For enhanced security, we enforce SSH access with <a href=\"https:\/\/www.ssh.com\/academy\/ssh\/public-key-authentication#public-key-authentication---what-and-why?\" target=\"_blank\" rel=\"noreferrer noopener\">public and private key authentication<\/a>. This method eliminates the risk of brute-force attacks by requiring cryptographic key pair instead of a password.&nbsp;<\/p>\n\n\n\n<p>Public and private key authentication works by generating a unique key pair; a public key stored on the server and a private key kept on your local device. Tools like <a href=\"https:\/\/www.puttygen.com\/#google_vignette\" target=\"_blank\" rel=\"noreferrer noopener\">PuttyGen<\/a> can help create these keys. When you attempt to connect, the server verifies your identity using the matching keys.&nbsp;<\/p>\n\n\n\n<p>In this article, we\u2019ll explore the essential commands to efficiently manage your WordPress <a href=\"https:\/\/www.20i.com\/web-hosting\" data-internallinksmanager029f6b8e52c=\"16\" title=\"web hosting\">web hosting<\/a> environment using SSH .&nbsp;&nbsp;<\/p>\n\n\n\n<p>Read our support guide on how to &nbsp;<a href=\"https:\/\/docs.20i.com\/reseller-hosting\/connect-via-ssh\" target=\"_blank\" rel=\"noreferrer noopener\">connect over SSH<\/a> across our shared and managed hosting services and <a href=\"https:\/\/www.20i.com\/blog\/best-ssh-clients\/\" target=\"_blank\" rel=\"noreferrer noopener\">the best SSH clients<\/a>&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>File Management<\/strong>&nbsp;<\/h2>\n\n\n\n<p><strong>Navigate Directories<\/strong>&nbsp;<\/p>\n\n\n\n<p>Here are a few commands for managing files and navigating directories in a Linux environment:&nbsp;<\/p>\n\n\n\n<p><strong>cd<\/strong>&nbsp;<\/p>\n\n\n\n<p>To change the current directory to another directory, you\u2019d use the \u2018cd\u2019 command.&nbsp;<\/p>\n\n\n\n<p>cd \/path\/to\/directory&nbsp;&nbsp;<\/p>\n\n\n\n<p>For example, the following will change to the wp-content folder:&nbsp;&nbsp;<\/p>\n\n\n\n<p><code>cd public_html\/wp-content&nbsp;<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"601\" height=\"401\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/03\/35-last-one.png\" alt=\"ssh cd command\" class=\"wp-image-15372\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/03\/35-last-one.png 601w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/03\/35-last-one-300x200.png.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/03\/35-last-one-370x247.png.webp 370w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/03\/35-last-one-270x180.png.webp 270w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/03\/35-last-one-570x380.png.webp 570w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/03\/35-last-one-150x100.png.webp 150w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><\/figure>\n\n\n\n<p><strong>pwd<\/strong>&nbsp;<\/p>\n\n\n\n<p>Sometimes, you will want to check where you are in the server environment. To do this, use g<strong> <\/strong>pwd. This command prints the current working directory.&nbsp;<\/p>\n\n\n\n<p>&nbsp;<br><code>pwd&nbsp;<\/code><\/p>\n\n\n\n<p><code>\/path\/to\/folder\/public_html\/wp-content&nbsp;<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1201\" height=\"801\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-pwd.png\" alt=\"ssh pwd command\" class=\"wp-image-15360\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-pwd.png 1201w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-pwd-300x200.png.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-pwd-768x512.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-pwd-400x267.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-pwd-800x534.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-pwd-832x555.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-pwd-150x100.png.webp 150w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/figure>\n\n\n\n<p><strong>ls -la &nbsp;&nbsp;<br><\/strong>&nbsp;<\/p>\n\n\n\n<p>This command lists all files and directories in the current directory, including hidden ones (files that start with \u2018.\u2019 such as .htaccess file) with details like permissions, owner, size, and modification date.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1201\" height=\"1239\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-ls-la.png\" alt=\"ssh is -la command\" class=\"wp-image-15353\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-ls-la.png 1201w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-ls-la-291x300.png.webp 291w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-ls-la-768x792.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-ls-la-400x413.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-ls-la-800x825.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-ls-la-832x858.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-ls-la-150x155.png.webp 150w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>File Operations<\/strong>&nbsp;<\/h2>\n\n\n\n<p><strong>cp&nbsp;<\/strong>&nbsp;<\/p>\n\n\n\n<p>The cp command allows you to copy files or directories to a new location. This is useful for creating backups or duplicating files.&nbsp;<\/p>\n\n\n\n<p>Examples:<\/p>\n\n\n\n<p>This command copies the contents of myfile.php to myfile2.php&nbsp;&nbsp;<\/p>\n\n\n\n<p><code>cp myfile.php myfile2.php&nbsp;&nbsp;<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1201\" height=\"801\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-cp-file.png\" alt=\"ssh cp command\" class=\"wp-image-15355\" style=\"width:624px;height:auto\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-cp-file.png 1201w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cp-file-300x200.png.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cp-file-768x512.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cp-file-400x267.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cp-file-800x534.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cp-file-832x555.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cp-file-150x100.png.webp 150w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/figure>\n\n\n\n<p>this command copies the file myfile.php to the \/plugins folder&nbsp;<\/p>\n\n\n\n<p><code>&nbsp;cp myfile.php public_html\/wp-content\/plugins &nbsp;<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1201\" height=\"801\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-cp-to-directory.png\" alt=\"ssh cp command plugins\" class=\"wp-image-15356\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-cp-to-directory.png 1201w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cp-to-directory-300x200.png.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cp-to-directory-768x512.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cp-to-directory-400x267.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cp-to-directory-800x534.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cp-to-directory-832x555.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cp-to-directory-150x100.png.webp 150w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/figure>\n\n\n\n<p><strong>mv&nbsp;&nbsp;<\/strong><\/p>\n\n\n\n<p>The mv command moves files or directories to a new location or renames them.&nbsp;<\/p>\n\n\n\n<p>Examples:<\/p>\n\n\n\n<p>Renaming a file&nbsp;<\/p>\n\n\n\n<p><code>mv oldname.php newname.php&nbsp;&nbsp;<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1201\" height=\"801\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-mv-old-new.png\" alt=\"ssh mv command\" class=\"wp-image-15357\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-mv-old-new.png 1201w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-mv-old-new-300x200.png.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-mv-old-new-768x512.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-mv-old-new-400x267.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-mv-old-new-800x534.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-mv-old-new-832x555.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-mv-old-new-150x100.png.webp 150w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/figure>\n\n\n\n<p>Move the wp-config-sample.php file to the parent directory:&nbsp;<\/p>\n\n\n\n<p>&nbsp;<code>mv wp-config-sample.php&nbsp; ..<\/code>&nbsp;&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1201\" height=\"801\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-mv-parent.png\" alt=\"ssh mv command 2\" class=\"wp-image-15358\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-mv-parent.png 1201w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-mv-parent-300x200.png.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-mv-parent-768x512.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-mv-parent-400x267.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-mv-parent-800x534.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-mv-parent-832x555.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-mv-parent-150x100.png.webp 150w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/figure>\n\n\n\n<p><strong>rm<\/strong>&nbsp;<\/p>\n\n\n\n<p>The rm command is used to delete files or directories. <strong>Use this command with caution, especially when deleting directories.<\/strong>&nbsp;<\/p>\n\n\n\n<p>To delete a file:&nbsp;<\/p>\n\n\n\n<p><code>rm file&nbsp;<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1201\" height=\"801\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-rm.png\" alt=\"ssh rm command\" class=\"wp-image-15361\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-rm.png 1201w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-rm-300x200.png.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-rm-768x512.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-rm-400x267.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-rm-800x534.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-rm-832x555.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-rm-150x100.png.webp 150w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/figure>\n\n\n\n<p>To delete a directory and all its contents recursively and forcefully&nbsp;<\/p>\n\n\n\n<p><code>rm -rf directory&nbsp;<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1201\" height=\"801\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-rm-rf.png\" alt=\"ssh rm -rf command\" class=\"wp-image-15362\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-rm-rf.png 1201w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-rm-rf-300x200.png.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-rm-rf-768x512.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-rm-rf-400x267.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-rm-rf-800x534.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-rm-rf-832x555.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-rm-rf-150x100.png.webp 150w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/figure>\n\n\n\n<p><strong>grep<\/strong>&nbsp;<\/p>\n\n\n\n<p>The grep command searches for a specific string of text within files. This is especially useful for locating code snippets, configuration details, or errors.&nbsp;<\/p>\n\n\n\n<p>Find occurrences of a specific function or string&nbsp;<\/p>\n\n\n\n<p><code>grep 'wp_enqueue_script' *.php&nbsp;<br><\/code>&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1201\" height=\"801\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-wp_enquee_script.png\" alt=\"ssh grep command\" class=\"wp-image-15363\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-wp_enquee_script.png 1201w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-wp_enquee_script-300x200.png.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-wp_enquee_script-768x512.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-wp_enquee_script-400x267.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-wp_enquee_script-800x534.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-wp_enquee_script-832x555.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-wp_enquee_script-150x100.png.webp 150w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/figure>\n\n\n\n<p>Search across all WordPress files recursively&nbsp;<\/p>\n\n\n\n<p><code>grep -r 'get_option' \/path\/to\/wordpress\/&nbsp;<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1201\" height=\"801\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-grep-r.png\" alt=\"ssh grep - search across all WordPress files recursively\" class=\"wp-image-15364\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-grep-r.png 1201w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-grep-r-300x200.png.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-grep-r-768x512.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-grep-r-400x267.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-grep-r-800x534.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-grep-r-832x555.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-grep-r-150x100.png.webp 150w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>File Permissions<\/strong>&nbsp;<\/h2>\n\n\n\n<p><strong>chmod&nbsp;<\/strong><\/p>\n\n\n\n<p>The chmod command allows you to modify file and folder permissions, which is crucial for maintaining security and proper functionality of your server environment.&nbsp;<\/p>\n\n\n\n<p>755 Grants full access to the owner and read\/execute permissions to others, commonly used for directories.&nbsp;<\/p>\n\n\n\n<p><code>chmod 755 directory_name<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1201\" height=\"801\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-chmod.png\" alt=\"ssh chmod command\" class=\"wp-image-15365\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-chmod.png 1201w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-chmod-300x200.png.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-chmod-768x512.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-chmod-400x267.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-chmod-800x534.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-chmod-832x555.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-chmod-150x100.png.webp 150w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/figure>\n\n\n\n<p>644 Grants read\/write access to the owner and read-only access to groups and others, typically used for files.&nbsp;<\/p>\n\n\n\n<p>To apply these permissions across your WordPress site you can change all file permissions and directory permissions by running the following commands.&nbsp;<\/p>\n\n\n\n<p>This searches for directories in the wordpress directory and updates the permissions to 755<\/p>\n\n\n\n<p><code>find \/path\/to\/wordpress -type d -exec chmod 755 {} \\;&nbsp;<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1201\" height=\"801\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-change-all-directories.png\" alt=\"ssh chmod command 2\" class=\"wp-image-15366\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-change-all-directories.png 1201w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-change-all-directories-300x200.png.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-change-all-directories-768x512.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-change-all-directories-400x267.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-change-all-directories-800x534.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-change-all-directories-832x555.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-change-all-directories-150x100.png.webp 150w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/figure>\n\n\n\n<p>This searches for files in the wordpress directory and updates the permissions to 644<br><br><code>find \/path\/to\/wordpress -type f -exec chmod 644 {} \\;&nbsp;<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"601\" height=\"401\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/03\/34-@wpclil-public-html-find-.-type-f-exec-chmod-644-.png\" alt=\"ssh chmod command 3\" class=\"wp-image-15371\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/03\/34-@wpclil-public-html-find-.-type-f-exec-chmod-644-.png 601w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/03\/34-@wpclil-public-html-find-.-type-f-exec-chmod-644--300x200.png.webp 300w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/03\/34-@wpclil-public-html-find-.-type-f-exec-chmod-644--370x247.png.webp 370w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/03\/34-@wpclil-public-html-find-.-type-f-exec-chmod-644--270x180.png.webp 270w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/03\/34-@wpclil-public-html-find-.-type-f-exec-chmod-644--570x380.png.webp 570w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/03\/34-@wpclil-public-html-find-.-type-f-exec-chmod-644--150x100.png.webp 150w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><\/figure>\n\n\n\n<p><strong>View File Contents<\/strong>&nbsp;<\/p>\n\n\n\n<p>When managing a WordPress site or server using SSH, you&#8217;ll often need to view or edit configuration files. Here are two essential commands to help you&nbsp;<\/p>\n\n\n\n<p><code>cat file&nbsp;&nbsp;<\/code><\/p>\n\n\n\n<p>This command displays the entire contents of a file.&nbsp;<\/p>\n\n\n\n<p>In this example, this shows the contents of the .htaccess file, used for configuring apache settings.&nbsp;<\/p>\n\n\n\n<p><code>cat .htaccess&nbsp;<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1201\" height=\"1239\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-cat.png\" alt=\"ssh view file contents - cat file\" class=\"wp-image-15367\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-cat.png 1201w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cat-291x300.png.webp 291w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cat-768x792.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cat-400x413.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cat-800x825.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cat-832x858.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-cat-150x155.png.webp 150w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/figure>\n\n\n\n<p><code>vim file&nbsp;<\/code><\/p>\n\n\n\n<p>Opens a file in the vim text editor for editing.&nbsp;&nbsp;<\/p>\n\n\n\n<p>Example:&nbsp;&nbsp;<\/p>\n\n\n\n<p><code>vim .htaccess&nbsp;<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1201\" height=\"1239\" src=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-vim.png\" alt=\"ssh view file contents - vim file\" class=\"wp-image-15368\" srcset=\"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/02\/ssh-command-vim.png 1201w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-vim-291x300.png.webp 291w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-vim-768x792.png.webp 768w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-vim-400x413.png.webp 400w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-vim-800x825.png.webp 800w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-vim-832x858.png.webp 832w, https:\/\/www.20i.com\/blog\/wp-content\/smush-webp\/2025\/02\/ssh-command-vim-150x155.png.webp 150w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Database Management<\/strong>&nbsp;<\/h2>\n\n\n\n<p>Managing a database is essential for maintaining and troubleshooting websites and applications. Below are some basic commands to access and manage your WordPress database.&nbsp;<\/p>\n\n\n\n<p><strong>Access MySQL\/MariaDB<\/strong>&nbsp;<\/p>\n\n\n\n<p>Logs into the database server. You\u2019ll be prompted to enter the password for username.&nbsp;<\/p>\n\n\n\n<p><code>mysql \u2013h hostname -u username -p&nbsp;<\/code><\/p>\n\n\n\n<p>Lists all databases available on the server. End with a semicolon (;) to execute the query.&nbsp;<\/p>\n\n\n\n<p><code>SHOW DATABASES;&nbsp;<\/code><\/p>\n\n\n\n<p>Switches to a specific database&nbsp;<\/p>\n\n\n\n<p><code>USE database_name;&nbsp;<\/code><\/p>\n\n\n\n<p>Lists all tables in the currently selected database.&nbsp;<\/p>\n\n\n\n<p><code>SHOW TABLES;&nbsp;&nbsp;<\/code><\/p>\n\n\n\n<p><strong>Export\/Import Databases<\/strong>&nbsp;<\/p>\n\n\n\n<p>Creates a backup of database_name and saves it to backup.sql.&nbsp;<\/p>\n\n\n\n<p><code>mysqldump -u username -p database_name &gt; backup.sql&nbsp;<\/code><\/p>\n\n\n\n<p>Restores the database from a backup file.&nbsp;<\/p>\n\n\n\n<p><code>mysql -u username -p database_name &lt; backup.sql&nbsp;<\/code><\/p>\n\n\n\n<p><strong>WordPress specific basic MySQL queries<\/strong>&nbsp;<\/p>\n\n\n\n<p>List All WordPress Users&nbsp;<\/p>\n\n\n\n<p>&nbsp;<br><code>SELECT ID, user_login, user_email FROM wp_users;&nbsp;<br><\/code>&nbsp;<\/p>\n\n\n\n<p>Get a List of Installed Plugins&nbsp;<\/p>\n\n\n\n<p><code>SELECT option_value FROM wp_options WHERE option_name = 'active_plugins';&nbsp;<br><\/code>&nbsp;<\/p>\n\n\n\n<p>Delete Spam Comments&nbsp;<\/p>\n\n\n\n<p><code>DELETE FROM wp_comments WHERE comment_approved = 'spam';&nbsp;<br><\/code>&nbsp;<\/p>\n\n\n\n<p>Reset user password&nbsp;<\/p>\n\n\n\n<p><code>UPDATE wp_users SET user_pass = MD5('NewPassword123') WHERE user_login = 'admin';&nbsp;<\/code><\/p>\n\n\n\n<p>(Replace NewPassword123 with a more secure password and you can replace \u2018admin\u2019 with the actual username)&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>WordPress-Specific SSH Commands (WP-CLI)<\/strong>&nbsp;<\/h2>\n\n\n\n<p>You can manage your WordPress website using <a href=\"https:\/\/www.20i.com\/blog\/get-started-wpcli\/\" target=\"_blank\" rel=\"noreferrer noopener\">WP-CLI<\/a> which is the command line for WordPress. You will be able to perform WordPress specific tasks such as WordPress core updates, Plugin updates, Theme updates, Plugin\/Theme installs and more.&nbsp;<\/p>\n\n\n\n<p>Updates the WordPress core to the latest version.&nbsp;<\/p>\n\n\n\n<p><code>wp core update<\/code><\/p>\n\n\n\n<p>Installs a plugin by name and activates it immediately.&nbsp;&nbsp;&nbsp;<\/p>\n\n\n\n<p><code>wp plugin install plugin_name --activate&nbsp;&nbsp;<\/code><\/p>\n\n\n\n<p>Example&nbsp;<\/p>\n\n\n\n<p><code>wp plugin install woocommerce --activate.&nbsp;<\/code><\/p>\n\n\n\n<p>Installs and activates a theme.&nbsp;<\/p>\n\n\n\n<p><code>wp theme install theme_name --activate&nbsp;<\/code><\/p>\n\n\n\n<p>Example:&nbsp;&nbsp;<\/p>\n\n\n\n<p><code>wp theme install twentytwenty --activate&nbsp;<\/code><\/p>\n\n\n\n<p>Displays a list of all WordPress users with details like username, email, and roles.&nbsp;<\/p>\n\n\n\n<p><code>wp user list&nbsp;<\/code><\/p>\n\n\n\n<p>Replaces instances of old_url with new_url in the database. Useful when migrating or updating site URLs.&nbsp;<\/p>\n\n\n\n<p><code>wp search-replace 'old_url' 'new_url'&nbsp;<\/code><\/p>\n\n\n\n<p><strong>Debugging<\/strong>&nbsp;<\/p>\n\n\n\n<p>Enables debugging in the wp-config.php file. Helps identify issues in development.&nbsp;<\/p>\n\n\n\n<p><code>wp config set WP_DEBUG true --raw&nbsp;<\/code><\/p>\n\n\n\n<p>Lists all scheduled WordPress cron jobs &nbsp;<\/p>\n\n\n\n<p><code>wp cron event list&nbsp;<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Summary&nbsp;<\/strong>&nbsp;<\/h2>\n\n\n\n<p>The commands in this article &nbsp;provide you a helpful starting point for managing your WordPress website\u2019s hosting environment using SSH. &nbsp;<\/p>\n\n\n\n<p>While SSH may seem complicated and daunting at first, with practice, it becomes an indispensable tool.&nbsp;<\/p>\n\n\n\n<p>To get comfortable, consider creating a test environment, such as a fake hosting package in your Reseller account or Managed Cloud server, where you can safely practice SSH commands without affecting your live websites.&nbsp;&nbsp;<\/p>\n\n\n\n<p>By mastering these basic commands, you&#8217;ll be well on your way to effectively managing your server and securely maintaining your site.&nbsp;&nbsp;<\/p>\n\n\n\n<p><em>Read more on SSH &#8211; <a href=\"https:\/\/www.20i.com\/blog\/best-ssh-clients\/\">The Best SSH Clients for Secure Remote Connections<\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"SSH (Secure Shell) provides a secure and efficient way to access your hosting or server environment. It allows&hellip;","protected":false},"author":25,"featured_media":15389,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"ub_ctt_via":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"csco_singular_sidebar":"","csco_page_header_type":"","csco_page_load_nextpost":"","footnotes":""},"categories":[288],"tags":[76],"class_list":{"0":"post-15318","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-security","8":"tag-wordpress","9":"cs-entry"},"featured_image_src":"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/03\/wordpress-website-using-ssh-title-scaled.png","author_info":{"display_name":"Ben Perry","author_link":"https:\/\/www.20i.com\/blog\/author\/benperry92\/"},"_links":{"self":[{"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/posts\/15318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/users\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/comments?post=15318"}],"version-history":[{"count":12,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/posts\/15318\/revisions"}],"predecessor-version":[{"id":18317,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/posts\/15318\/revisions\/18317"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/media\/15389"}],"wp:attachment":[{"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/media?parent=15318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/categories?post=15318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/tags?post=15318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}