SFTP, SSHFS, VPN + exportFS, and WebDav.

While working on some code, I needed to get something I could access much faster and much easier than my current methods.  So after some testing, I’ve come across a solution.

I started with my simple SSH session.  This proves to not be so helpful when editing multiple files or needing to move around easier.  While the power of command line is great, it isn’t so great for developing larger scripts or moving around between multiple files easily.

So onto SFTP.  I used a sftp shelled user by adding that user to a group and forcing that group in my sshd.conf to always use sftp:

This works very awesome and is much more secure than FTP. It is using the SSh backend, which is very secure but foces it down to a ftp layer. The jailed user can’t run any commands, no forwarding, and is chrooted to a directory (their home in this case). However, this was slow. On average it would take 4 seconds to load a file. Directory listings where fairly fest (usually 1 second, sometimes 2). Unacceptable delays just to edit a file.

Since SFTP was out of the question, I figured it would be similar, but gave it a try anyways. I setup SSHFS using OSXFuse and SSHFS and then MacFusion.app (A simple GUI to test with, if it worked I would learn to use the CLI). With that setup, it was even worse. Files would open in 1-2 seconds, but directory listings just took forever, sometimes not even loading at all.

As SSHFS was not a option and since I wanted to try it anyways, I tried to setup VPN. OpenVPN being the choice here, I spent a few hours working on setting this up. This took a bit to configure as my firewall was blocking a lot of the connections, even once I got the right port configured, the firewall still blocked access. But once I sorted out allowing that private traffic and getting the certs in the right place, I got connected to my new VPN. I will note that if you don’t sign the certificate, it doesn’t produce a valid .crt file. So make sure to say yes to that.

After setting up VPN, I needed to setup exportfs so I could export the directory I wanted. More troubles with that. A combination of the correct options on server side (rw,sync,no_subtree_check,insecure,anonuid=1000,anongid=1001,all_squash) and the right ones on the client side (-o rw,noowners -t nfs) to finally get it to work properly. Alas after all these troubles, it was the same issue as SSHFS. Slow directory loading. This was unacceptable and would not do.

Finally, tried WebDav. At first I was trying it in a directory, but my location directive for php files in Nginx was wreaking havoc. So I just setup another subdomain to deploy this under. It also appears that Nginx at least on Ubuntu 12.04 (possibly similar versions on Debian as well) has the dav module and extension (for full support) built into it. I simply just needed to setup the configuration for it. Really easy to do and didn’t take much time, I think I set that up in less than 30 minutes).

The result is great. WebDav is fast. Directory listings are almost instant and files open in just a second. While OS X (Mountain Lion) does not seem to have the correct support for WebDav and attempts to look foe resource files and other hidden files (such as a .ql_disablethumbnails which I assume is for QuickLook to not load a thumbnail). So it was over to my FTP client that supported WebDav. Wish I could of had native Finder support for it, but oh well.

A IRC user said it best though and I couldn’t agree more now: < rnowak> SleePy: webdav rocks, totally underused.

Droid 4 Verizon Update fails on rooted devices

Finally Verizon has released Ice Cream and my Droid 4 got the notice. However my device is/was also rooted to remove that bloatware. To my frustration it seems that the update was failing, again and again.

I want to make special notice of a trick I learned. Just after it reboots to install the update, when the android system update screen shows up, hit the up+down keys (No Konami code here). This brings up the event log/diagnostics type screen which tells you what is going on. As well this helpful menu also shows you why it fails to apply an update.

In my case it was failing on “/system/app/VCASTVideo.apk”. To the internet and after hours of searching, I finally came across a solution. This only works on rooted devices though. A kind internet user has posted a Droid 4 dump (http://www.droidforums.net/forum/droid-4-hacks/198775-droid-4-dump.html). After downloading those parts, I was able to extract the files and locate the app/VCASTVideo.apk file.
After I had that, I simply plugged in my droid into my computer, using the fancy USB Mass storage device. Transfered it to my SD card. This was kind of a pain as it appears there is two partitions it mounts. One of them shows up properly when looking for others, the other one I didn’t try to locate (should of though).

Once on the sdcard though, I simply unplugged it from the computer, waited for it to reattach the sdcard to my phone and then opened up Root Manager. Using this utility (which requires root), I was able to copy that to the /system/app, fixed permissions (-rw-r–r–) and retried the update.

I had another application that also failed, but it was rinse and repeat at this point. After that it finally did the update. This took me hours mostly because the update had to download each time again before I could apply it. I never did try to see if I couldn’t patch it from my SD card like some suggest/say is possible.

I am very thankful to the anon who provided that droid 4 dump and the many others that I went through while trying to fix my device. Hopefully those files don’t go away for a few months as I am sure they will be very helpful for those rooted phones trying to update. As well it seems I shouldn’t delete bloatware, but freezing them seems better.

As well, Voodoo OTA RootKeeper is a must. Installing/running this prior to running the updates and now even after applying ICS, it appears I can restore the root with no problem.