How to connect an instance by ec2-user to (S)FTP client software

 

To connect the Amimoto instance with an SFTP client, you need an application of SFTP and a secret key file of the instance(.pem).

You can connect the instance with the ec2-user user, but the directory which WordPress is placed in, /var/www/vhosts, is owned by the nginx user who runs the web server, so you can’t upload files here with the ec2-user user.

This post describes how to change the running user of Nginx and php-fpm, also make the ec2-user user upload files and so on.

1. Change the running user of nginx and php-fpm to ec2-user (only after instance creation)

First, open /opt/local/amimoto.json file, replace the contents with the following:

{
"nginx" : { "config" : { "user" : "ec2-user" } },
"php" : { "config" : { "user" : "ec2-user" } },
"run_list" : [ "recipe[amimoto]" ]
}

For AMIMOTO HHVM version, rewrite as follows:

{
"nginx" : { "config" : { "user" : "ec2-user" } },
"php" : { "config" : { "user" : "ec2-user" } },
"hhvm" : { "enabled" : true, "config" : { "user" : "ec2-user" } },
"run_list" : [ "recipe[amimoto]" ]
}

Then run /opt/local/provision with root privileges.

$ sudo /opt/local/provision

Upon completion, change the owner of /var/www/vhosts for the ec2-user user to operate the directory.

$sudo chown -R ec2-user:nginx /var/www/vhosts

 

2. Connect with (S)FTP Client Software

Server connection settings

  • Server: Instance IP Address 
  • Username: ec2-user
  • Secret key
  • Path: /var/www/vhosts/ {instance name (optional) }
  • Connection method (Port): SFTP (22)

Examples of (S)FTP Client Software connection:

An example below is Cyberduck, enter the server information, check “Use Public Key Authentication” and choose private key (.pem) when prompted.

Share on facebook
Share on google
Share on twitter
Share on linkedin