Skip to content

Instantly share code, notes, and snippets.

@oropesa
Created December 15, 2014 14:29
Show Gist options
  • Save oropesa/c2728957375f4744b7df to your computer and use it in GitHub Desktop.
Save oropesa/c2728957375f4744b7df to your computer and use it in GitHub Desktop.
Edit wp-config.php to update WP by FTP-SSH2
1. Install SSH2 and PHP mod, and restart Apache2
|- #> sudo apt-get install libssh2-1-dev libssh2-php
\- #> sudo service apache2 restart
2. Generate RSA keys, Create authorized_keys, and Update permissions
|- #> ssh-keygen
|- TIP: do not save them in your web directory
|- #> cd .ssh/
|- #> cp id_rsa.pub authorized_keys
|- #> cd ../
|- #> chmod 775 .ssh
\- #> chmod 644 .ssh/*
3. Add FTP configuration lines in wp-config.php file
// START FTP EDIT
define( 'FTP_PUBKEY', '/home/.ssh/id_rsa.pub');
define( 'FTP_PRIKEY', '/home/.ssh/id_rsa');
define( 'FTP_USER', 'ftp-user' );
define( 'FTP_PASS', 'ftp-password' );
define( 'FTP_HOST', 'ftp-host:22' );
define( 'FS_METHOD', 'ssh2');
// END FTP EDIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment