Two SSH Commands for WordPress Sites

Two commands I type often enough to keep written down.

Copy your SSH public key to the clipboard

Use the following command in terminal to copy your SSH public key to your clipboard on a Mac. Be sure to swap out the path and file name with your own if necessary.

Shell
cat ~/.ssh/id_rsa.pub | pbcopy

On Linux there’s no pbcopy, so pipe it to xclip instead:

Shell
cat ~/.ssh/id_rsa.pub | xclip -selection clipboard

Change WordPress file and directory permissions

Login to your server via SSH and enter the following commands to change your WordPress directory and file permissions.

Directory Permissions

Set permissions on all directories to 755.

Shell
find . -type d -print -exec chmod 755 {} \;

File Permissions

Set permissions on all files to 644.

Shell
find . -type f -print -exec chmod 644 {} \;
Filed under: , ,
Share

Leave a Reply

Your email address will not be published. Required fields are marked *