Mount a Webdav folder in Ubuntu Linux

Webdav is a very handy protocol for writing files back and forth across the internet.

I’ve never really had much call for it – but I’m all for it lately as I’m trying out Alfresco and would really love to see a better way to upload files than the basic web-bsaed uploader that is provided.

As Firefox doesn’t had webdav support, I’ve had a go at mounting webdav folders in Linux. The results have been good, with a couple of small caveats that are remedied fairly easily.

First of all, you need to install the davfs2 package. Once done, we can start connecting to a webdav folder on t’internet:

Open up the terminal and create the mount folder:

mkdir ~/webmount

Now run the mount.davfs command to connect as root

sudo mount.davfs http://yourwebsite.com/webdav ~/webmount -o rw,uid=john

Now, let me quickly explain the paramters.
yourwebsite.com/webdav is the server and path
~/webdav is your local directory where you want to webdav files to appear
-o rw,uid=john is the options to set the webdav as re-writable and allow me (john) to have user-level access to the files. Make sure that you put your own username here.

And that’s it.

When you copy files, you might get an error such as this:

cp myfile.pdf ~/webmount/

cp: cannot create regular file `~/myfile.pdf’: Input/output error

This is caused by the server not supporting file locks. You will need to edit the /etc/davfs2/davfs2.conf file and add the following line:

use_locks       0

Remount your webdav directory, and you should be able to create files with no problems.

Tunnelling on the fly

I’ve just been tweaking with SSH. One of the common things that I have to do is reconfigure my SSH tunnels while I’m working remotely to gain access to desktops and the like.

In this situation, the cumbersome but easiest way always seemed to be to disconnect and change the command line. However, having used Putty I was fairly sure that there must be an easier way.

AND THERE IS!

Changing the port forwarding in ssh is as easy, if not easier, than in Putty.

While you’re connected to the host, type a tilde (~) and an uppercase C.This will open the ssh shell. Just type in your port forwarding command like you would when you are typing in the command line option. eg:

<code>-L 3389:localhost:3389</code>

to tunnel an RDP socket to the machine that you are connected to.

And that’s it! If you’re stuck, type a question mark (?) and press ‘Enter’. This will show you the options available.

No More Lost Deleted Files in Ubuntu

I had a shocking error of judgement this morning when I accidentally deleted some of my son’s photos from his toy digital camera. They were sitting on my desktop, and I was on a cleanup… These were a casualty of my cleanup-fest and obsession with the shift key.

Thinking on a Windows vein – I thought that I should be able to backup the files easily and seamlessly. But I don’t want too much aggravation. A quick scoot around the Ubuntu forums, and I found TimeVault.

TimeVault is the equivalent project to Windows’ Shadow Copy service or Apple’s Time Machine. Basically it’s a completely transparent backup that allows you to recover files easily on the system you are working on.

I’ve downloaded the .DEB and forced the installation (there’s no binary x64 version at the moment). I’ll see how it all goes and report back!

Adding Printers will Hang a Vista Logon to a Domain

When you’re setting up a Windows Vista system on your network for the first time, you might find that adding printers becomes an issue because the UAC prompt appears.

Unfortunately, if you do this with a logon script – then the logon will hang until the script timeout expires. Worse still, if you’re using Group Policy Preferences to set up the printer it will cause the logon to hang indefinitely.

If you’re experiencing this problem – then you need to make sure that the Trusted Printer settings are either configured correctly, or disabled so that printer installation behaves as it would in previous versions of Windows such as 2000 and XP.

Firstly, you’ll need to open the Group Policy Management console, and navigate to the OU which contains the user accounts that are likely to add printers and edit the policy.

Open User Settings >Administrative Templates > Control Panel > Printers.

To prevent Vista from ever prompting to install the printer drivers, simply disable the Point and Print Restrictions setting. If you need to control where printers can be installed from then you need to edit the Approved Servers setting instead.

If you’ve used group policy preferences, make sure that you’ve set the Run in logged-on user’s security context option.

Once configured, you should be able to log on with a user account that automatically adds the printer without a hitch.

Set the default Organisational Unit for New Computers in Windows Server

Once you have your domain and group policies set up, it can become frustrating to constantly have to remember to move a new computer into the correct OU.

Luckily in Windows 2003 and above, you can set a default OU:

<code>redircmp ou=ComputersOU,dc=mydomain,dc=com</code>

Remember to replace the path with your own domain’s OU path. Also, your domain has to be running in at least Windows Server 2003 native mode – otherwise you will receive an error:

Error, unable to modify the wellKnownObjects attribute. Verify that the domain functional level of the domain is at least Windows Server 2003:
Unwilling To Perform
Redirection was NOT successful.

To change this:

  • On the server go to Administrative Tools > Active Directory Domains and Trusts.
  • Right-click on your domain name, and click on Raise Domain Functional Level.
  • Set the domain level to at least 2003

Now you should be ready to go!