====== Guides: Web server: Part 4 ====== * [[:guides/webserver|Back to Guides: Webserver]] * [[:guides/webserver/part3|Back to Guides: Webserver Part 3]] ====== Editing Files ====== How to edit files on a remote server (i.e. on your Amazon EC2 instance): ===== Windows ===== ==== SSHFS ==== * Install [[https://github.com/billziss-gh/sshfs-win|SSHFS-Win]] * The first steps include installing [[https://github.com/billziss-gh/winfsp/releases/latest|WinFsp]] * Install the [[https://github.com/evsar3/sshfs-win-manager|SSHFS-Win Manager]] ==== Notepad++ ==== Download Notepad++ from https://notepad-plus-plus.org/download/ ([[https://download.cnet.com/Notepad/3000-2352_4-10327521.html|alternative download link]]) Once installed, click **Plugins**->**Plugins Admin** and search for **NppFTP**, tick the checkbox then click **Install**. After Notepad++ restarts, click **Plugins**->**Show NppFTP Window** Then, in the top right window that has now appeared docked in your Notepadd++ window, click the **Settings** icon (the gear), then **Profile settings** Click **Add new** and give it a name. Enter your details for your Amazon EC2 server: |Hostname|Your EC2 IP address (or hostname)| |Connection type|**SFTP**| |Username|ubuntu| |Initial remote directory|/var/www/html/| Click on the **Authentication** tab, untick **Try password authentication** and tick **Try private key authentication**, then click on the browse button next to the **Private key file** box, find your original **PEM** file (not the converted PPK file). Once that key has been selected hit **Close**. You can now connect to your server by using the top left **Connect** icon in the NppFTP window (top right section of Notepad++) and choosing the server you named above. You should now be able to see/edit the ''test.php'' file you created earlier. ===== Linux ===== You are able to mount your remote server directly using sshfs: sshfs -i identityfile.pem ubuntu@your_ec2_ip:/var/www/html/ my_ec2_server/ You can then use any editor and access the server files directly from the my_ec2_server directory. ===== MacOS ===== To transfer a file to the server with minimal fuss then use the built in Secure Copy command: scp file.php ubuntu@your_aws_ip:/var/www/html However, for transferring many files you may want to mount the remote directory with sshfs \\ Install the package manager HomeBrew if you don't have it already: https://brew.sh/ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" Now use HomeBrew to install sshfs brew install sshfs Create a shortcut for your server by using this template and saving it to ''.ssh/config'' in your home directory (/Users/yourusername) Host server_name User ubuntu Port 22 HostName IPADDRESS IdentitiesOnly yes IdentityFile file_location For example: Host my_amazon_server User ubuntu Port 22 HostName 10.45.23.1 IdentitiesOnly yes IdentityFile /Users/neil/myamazonkey.pem Make sure you can ssh into your amazon server using the ''server_name'', e.g: ssh my_amazon_server If that works, you can use a similar sshfs command as above: sshfs my_amazon_server:/var/www/html/ my_ec2_server/ More discussion can be found [[http://glasgowcodingmeetup.freeforums.net/post/18|on the group forums]] * [[Guides/Webserver/Part5|(next) Webserver Part 5: Basic Form]]