MT as a Remote Editor

9 October 2004

26 comments

A few times while traveling around Australia, either I’ve noticed a slight glitch on a site (Stopdesign, or a client site), or someone else points out a bug or problem with some file on a site I have control over. I left my laptop and cables, etc. in Sydney to shed the weight, so I haven’t had access to the tools I normally have at my disposal. Any of these changes are usually quick edits or corrections of previous oversights, assuming I have any type of net connection and my normal toolset with me. However, I’ve been missing some sort of text editor that can work on files remotely via S/FTP.

Many of the Win PCs in internet cafes are configured with quite a few restrictions, such as the inability to run anything from the command line. For me, it would be highly convenient if I could just SSH into any server I have access to, open the offending file with pico or vi, make any necessary changes, save, and be done with it. But since I’m unable to run cmd.exe from many of these machines, I hadn’t discovered an easy way to edit files remotely.

That is, until I remembered how easily I could edit any text file on the server by logging into the copy of Movable Type installed on that server. MT has come in quite handy over the past week as a make-shift CMS that can modify more than just blog entries and associated templates. It can actually be used to edit any text-based file within its reach.

The how to: Simply create a new Index Template, make sure absolutely nothing is in the Template Body field (not even a single space character), then link that template to any existing file on the server by using a path relative to the Local Site Path set on the Weblog Config > Core Setup page (this is in MT2.6 — it might be named something different in MT3.x).

For instance: If your Local Site Path is set to the home directory of your web server, and you have a file called header.php within a functions directory at the next level down, set the Link this template to a file path to functions/header.php with no initial slash, ensure nothing is in the Template Body field, save the template, and the contents of that file will be loaded into the previously empty Template Body field, giving you full access to edit the file any way you want.

Put into practice, one of my PHP functions was misbehaving last week because of improper syntax. I simply pointed a new index template at that file, made the needed changes, then saved the template which overwrote the file, and the problem was fixed. Same thing was done to fix a few bugs on Maggie’s Mighty Goods site. You can either choose to keep the template file in case you might want to change it later, or you can toss it to keep your template list short and clean. I prefix any of the template names I create for this purpose with REMOTE:, in case I forget to delete it, and come back later wondering why that template exists. I know anything with REMOTE: in the name is disposable and not relevant to the core functionality or content of the site.

It’s possible there’s an even easier means of editing remotely. But MT is working quite well for my purposes, and it’s dead simple to use in this manner.

Posted in Locations, MovableType, Technology

26 comments (Comments closed)

1. At 8:12pm on 8 oct 2004, Mike Steinbaugh wrote:

Doug,

I too use this feature, but be careful with it. If you link to remote files to edit them without an SFTP client, make sure you don’t re-install MT. When you reinstall, this will overwrite the remote files when the MT database is updated. I’m not sure this happens when you only run upgrade scripts, but this problem has happened to me before.

Otherwise, it’s a great trick.

2. At 8:20pm on 8 oct 2004, Michael Roper wrote:

True, I have discovered this to work good on previous occasions. There may be a couple gotchas in there though, as I found when I first tried to do it. MT runs under whatever *nix user Apache is running under, so if the user that transferred the original file to the server is different, you might get a few ‘permission denied errors’ coming from MT. I guess it all depends on where your site is hosted, and how MT was installed…

3. At 8:29pm on 8 oct 2004, Douglas Bowman wrote:

Good point Michael. I’ve always run MT under cgiwrap or suexec, so the files are always created and edited as me, all under the same user name. Thus, I can manipulate the same files via SSH, FTP, or MT without problem. This wouldn’t be the case outside of cgiwrap or suexec, where the files might be created as “nobody” or some other generic Apache user.

One of the reasons I’d always recommend running MT under either cgiwrap or suexec if your host allows/provides it. Plus, this way it’s more secure, and you’ll have less permission-related hassles later on.

4. At 11:23pm on 8 oct 2004, Dante wrote:

Funny. I was just thinking about getting MT. It is hard to install, and is there a free version?

From all the talk I hear about it on the web, I gather that MT is quite a good piece of software.

5. At 11:55pm on 8 oct 2004, AkaXakA wrote:

Funny you talk about being very very carefull about it, as up to right now your site’s styling was completely mangeled! (it actually just changed as I was writing this)

I guess this is one of the side effects of editing your css on a live site…

6. At 12:34am on 9 oct 2004, cam c. wrote:

Dante, just go to www.movabletype.org and download the free copy; it is for non-commercial use and you are limited to 5 weblogs, but for most people, that is probably more than enough.
The new version also has dynamic page generation, so now your archive files can be generated dynamically from the database… I haven’t installed the latest yet, but this feature is very attractive…

7. At 2:27am on 9 oct 2004, Gabriel Mihalache wrote:

Webmin via an Apache proxypass can give you access to most system settings (and edit any file), via port 80 regular HTTP. Webmin wants a port of its own, but if you configure a proxypass, you can have /webmin on port 80 point to it.

8. At 2:38am on 9 oct 2004, Douglas Bowman wrote:

AkaXakA, I haven’t touched this site’s CSS file or any associated style functions for almost a month. When using MT this week, I was only modifying files from my presentations in Sydney, unrelated to Stopdesign.

What you were seeing must have been some other type of glitch with your connection, or possibly you had an older cached version of the style sheet that needed updating…

9. At 3:07am on 9 oct 2004, Dave wrote:

You could always use a Java SSH/SFTP Applet. MindTerm is a nice free one that works well. You can either download a zipped version from their site or search for a site running the applet such as http://www.netspace.org/ssh/. It’s designed to work with JRE v1.1 so it should run in just about any browser with Java support.

10. At 3:27am on 9 oct 2004, Simon Cox wrote:

Great workaround and one I have used on many occasions even when I am at home. I love the ability of MT to update template files and accept amends from other methods to that file as well. When I am away I often use the editing features in CPanel that are on my LAMP server.

11. At 8:04am on 9 oct 2004, James Z wrote:

Personally a USB key and Putty works pretty well in a pinch. It is a small exe file that does not require nay install. Personally, I have never learned anything about the DOS CLI, and I hope to keep it that way ;-).

12. At 12:30pm on 9 oct 2004, AkaXakA wrote:

Doug - You’re right, as I found out later it actually was a glitch todo with some extention troubles. No other site was affected though, but when I opened it in Opera it was the way it should be.

James Z - Quite a lot of webcafe’s I know of don’t like customers sticking their own stuff into the pc’s. Don’t know if that’s just here though, or my lack of luck.

13. At 8:29pm on 9 oct 2004, scott wrote:

Very interesting idea. This is a tip worth keeping.

14. At 6:39am on 10 oct 2004, Jason Earl wrote:

If you have a comtrol panel with your hosting, such as Direct Admin, Webmin, Plesk (or dare I say it, CPanel), then there is often an option to use a Java based SSH (or VNC in some rare cases) client that is written in Java. This is provided there is no firewall for port 22 + the control pannel port (normally, 8443, 2222, 2095, or 10000)

Likewise as someone said above, putty + USB pen works well, provided the security policy of the local machine is not too strict.

15. At 6:42pm on 10 oct 2004, Chris Messina wrote:

Textmate will supposedly feature remote SFTP editing in the future… probably not quite the same as using MT, but worth watching.

16. At 7:48am on 11 oct 2004, Bryan Buchs wrote:

It’s probably worth mentioning that if you do happen to leave a space character in the Template Body of the new “Remote” template, and link that template to an existing file, you will overwrite the contents of the existing file with that single space character. So be careful.

Great tip, though. I have all of the pages on my site set up as editable templates, even the ones that MT isn’t involved with, in case I need to make a quick edit.

17. At 2:50pm on 11 oct 2004, alex wrote:

Each day it seems like MT is getting more powerful, leading to much more complexity and additional headaches.

Is there a MT_Lite version that doesn’t try to be the “everything you ever wanted to do on a blog” tool?

I read stories about how people knocked their heads against the wall configuring the updates, working late nights, and trying to get everything working right. It’s scary.

Why can’t we keep it simple(r)?
What about a “presentation management” layer, just like the content management?

frustrated that the hurdle to enter a personal blog is getting higher that my options are blogger or livejournal. even blogger is becoming complicated with all the options and profiles and all. At least they allow email posting.

18. At 11:49pm on 11 oct 2004, Jim Amos wrote:

I also use MT to manage my site remotely. It comes in handy if I’m online at a library or at somebody else’s office and suddenly notice a typo or unclosed tag in one of my files. Very handy. As keith Robinson pointed out recently, with a lot of websites there’s often no need for a full CMS because the blog software provides most of the flexibility you need already. Good stuff.

As an additional note, you might add that users should make sure they don’t set MT to automatically rebuild these non-blog files - it’s obvious really, but could easily cost you some unwanted extra bandwidth/server load.

19. At 3:11am on 12 oct 2004, mattymcg wrote:

Hi Doug

I have found that installing the Invision file manager has been worth it. I originally installed it for clients to allow them to edit files directly on their site without them requiring an SFTP/SSH account, but I have used it more than once when in a similar situation you describe. It’s not large so having it on there is nice to know that I can access everything on my site when I don’t have any tools apart from a browser.

20. At 4:19am on 12 oct 2004, rjt wrote:

WinSCP is available as a standalone executable with a (basic) integrated text-editor. It claims to do SFTP in addition to SSH (although I must admit to only using the latter myself).

21. At 10:51pm on 12 oct 2004, Abhi wrote:

This might cause some security loopholes in virtual hosts. Otherwise its great.

22. At 2:29am on 13 oct 2004, M. Caleb wrote:

The Invision file manager is neat, but it’s not that easy to use, and sometimes my clients balk at using it. I found Afian Document Manager, and it’s much more suitable for non-technical people, because it looks more like the Windows Explorer. The text editor is rather simple though; does the job, however.

23. At 3:24am on 14 oct 2004, Bret R. Zaun wrote:

As a desktop application I can recommend FTPEditor for such a purpose. I use it alot to edit websites from various places and I am greatly pleased by its functionality.

24. At 4:24am on 15 oct 2004, Jay Allen wrote:

Hey Doug, I’ve been using this method for a few years to edit PHP include files which pull together certain parts of my site, as well as my blogroll (yes, it’s not a ‘blog’), and even some flat file CSV databases.

And of course, there’s the lovely direct style-sheet editing trick (where you put the path to your style sheet in first the output file field and then linked file fields) which obviates the need for rebuilds and lets you edit the file either through the web browser or the file system.

Yes, a lovely tip indeed…

Doug wrote:
“It can actually be used to edit any text-based file within its reach.”

That’s the catch. At least with 2.661 (haven’t tried with MT 3), you could not edit certain files (for example .pm and .cgi files to name a few) for security reasons. That is, unless of course, you hack MT to allow you to do so (ahem). Of course, I wouldn’t recommend it on a shared installation.

alex wrote:
“Each day it seems like MT is getting more powerful, leading to much more complexity and additional headaches”

Actually, this “feature” has been available since the very first version of MT three years ago so it has lent no extra complexity to MT.

Anyhow, to your point, there is no doubt that more power often leads to more complexity, although certainly it doesn’t have to be proportional. By its very nature, server-side software will always require more knowledge on the part of the user than a hosted service.

Six Apart has and continues to put a great deal of effort into making things as simple as possible for those who aren’t so tech savvy. If you think things are complicated now, you are probably unaware of what you are currently being sheltered from and exactly how bad it could be had such care not been taken in the past by the 6A techies.

alex wrote:
“Is there a MT_Lite version that doesn’t try to be the “everything you ever wanted to do on a blog” tool?”
[…]
“frustrated that the hurdle to enter a personal blog is getting higher that my options are blogger or livejournal.”

In case you haven’t seen it, TypePad is essentially the “MT-Lite” you are looking for although, in terms of features, you don’t lose much and in fact even gain some new features before they get rolled into MT.

25. At 7:42am on 16 oct 2004, Ben wrote:

I actually installed MT I tried to make it work for a blog/portfolio/articles site. I succedeed in it but I found then that MT was not flexible enought. I think that it comes from that it has been done for CGI but they should do a PHP version of MT, more flexible.

26. At 11:04pm on 17 oct 2004, Neerav wrote:

Doug

I have used www.web2ftp.com for the very purpose you speak of, it supports Remote FTP with a choice of SSL

Earlier this year I was on holidays in the south coast of New South Wales (Australia) when a client frantically emailed me saying that their Products page mentioned a shirt which was described as:

“White [name of company with crocodile logo] fabric “

Thanks to www.web2ftp.com I had the offending name removed in a few minutes, the client was happy and the [name of company with crocodile logo] stopped badgering them :-)

Note: the interface is in German but after a bit of experimenting you will know what each button does

Comments no longer open for this entry.

| Next entry


Upcoming Events

View all Events

Recent Entries

Latest links Subscribe to Stopdesign's Links feed

View all links

The easy way to manage projects: Basecamp
Recommended without hesitation for easy, web-based project management software.

716