How To Use FileZilla/SFTP To Update Site in OpenShift


In the recent post, I mentioned about OpenShift, a PaaS Service that offers Free Hosting. You can update your application using GIT. OpenShift also provides SSHing into your application. You may have heard of FTP protocol which allows you to transfer files through web. Most hosting companies use FTP protocol to update client apps. OpenShift unlike AppFog have FTP support, but in a different manner.

It has SFTP support ie SSH File Transfer Protocol. SFTP is a FTP like protocol that allows to transfer files via SSH sessions. Most FTP clients support SFTP. FTP client FileZilla supports SFTP which means that you can use FileZilla for updating site hosted on OpenShift. You can download FileZilla from here available for Linux, Mac & Windows.

You should mention the ssh-key you gave to OpenShift in FileZilla too.

For that Got to **Edit Menu **-> Settings and choose the tab SFTP :

Click on Add keyfile and choose the file containing the ssh-key. Normally on a **Linux system it will be /home/user/.ssh/id_rsa**. When you select the SSH key file, FileZilla will ask for to save the key file in a format FileZilla understands. Choose Yes and save it in /home/user/.ssh with the name filezilla.

Now, go to your OpenShift account and get the username of the SSH account.

Here’s how to get the username :

ssh://[email protected]/~/git/demos.git/

The username of the above SSH command is **198734c26793ca219000106d **and the host is demos.subinsb.com.

Now, type in the credentials you got from the SSH command into FileZilla.

Example :

Host     : sftp://<b>demos.subins.com</b>
Username : 198734c26793ca219000106d

Leave the Password field blank, because we already have an ssh-key that will authorize us.

You will now have complete access to your app’s hosted directory.

If you want to update the source code paste/add/remove you’re source code in the **app-root/repo/php **or whatever the language is.

Screenshot :

Note that if you do a git push to the application, the changes made by SFTP will be replaced. So, be careful while doing a git commit to application if you have made changes to code by SFTP.

If you have any problems / suggestions / feedback type it out in the comments.