Cadaver – A command-line WebDAV client for Unix

What it does?

file upload, download, on-screen display, namespace operations (move and copy), collection creation and deletion, and locking operations.

How to get it:

You can get it from here . As I am sitting on Gentoo and it’s repository has it already,so I go it like below:

bhaskar@bhaskar-laptop_10:47:41_Fri Sep 24:~> sudo emerge -av cadaver

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N    ] net-misc/cadaver-0.23.3  USE="nls" 813 kB

Total: 1 package (1 new), Size of downloads: 813 kB

Would you like to merge these packages? [Yes/No] y

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) net-misc/cadaver-0.23.3
>>> Downloading ''
--2010-09-24 10:47:56--
Resolving,,, ...
Connecting to||:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: [following]
--2010-09-24 10:48:00--
Resolving,,, ...
Reusing existing connection to
HTTP request sent, awaiting response... No data received.

--2010-09-24 10:48:06--  (try: 2)
Connecting to||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 831884 (812K) [application/x-gzip]
Saving to: `/usr/portage/distfiles/cadaver-0.23.3.tar.gz'

==================================>] 831,884     1.15K/s   in 2m 33s

For working with it I have created a directory for it in web space like below:

bhaskar@bhaskar-laptop_10:57:11_Fri Sep 24:~>sudo mkdir -p/var/www/localhost/htdocs/webdav

bhaskar@bhaskar-laptop_11:08:07_Fri Sep 24:~>ls -ls /var/www/localhost/htdocs/webdav/
total 0

bhaskar@bhaskar-laptop_11:08:25_Fri Sep 24:~>ls -ld /var/www/localhost/htdocs/webdav/
drwxr-xr-x 2 apache apache 4096 Sep 24 11:08 /var/www/localhost/htdocs/webdav/

Now I have mod_dav built with apache as module.Here it is:

bhaskar@bhaskar-laptop_11:17:54_Fri Sep 24:/etc/apache2/modules.d>ls | grep mod_dav

And the config look like below:

 <IfDefine DAV>
 2 DavLockDB "/var/lib/dav/lockdb"
 4 # The following directives disable redirects on non-GET requests for
 5 # a directory that does not include the trailing slash.  This fixes a
 6 # problem with several clients that do not appropriately handle
 7 # redirects for folders with DAV methods.
 8 <IfModule setenvif_module>
 9 BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
10 BrowserMatch "MS FrontPage" redirect-carefully
11 BrowserMatch "^WebDrive" redirect-carefully
12 BrowserMatch "^WebDAVFS/1.[012345678]" redirect-carefully
13 BrowserMatch "^gnome-vfs/1.0" redirect-carefully
14 BrowserMatch "^XML Spy" redirect-carefully
15 BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
16 </IfModule>
17 </IfDefine>
19 # vim: ts=4 filetype=apache

Now in main apache config file it shows like this:

 <IfDefine DAV>
 85 LoadModule dav_module modules/
 86 </IfDefine>
 87 <IfDefine DAV>
 88 LoadModule dav_fs_module modules/
 89 </IfDefine>
 90 <IfDefine DAV>
 91 LoadModule dav_lock_module modules/
 92 </IfDefine>

I am going to create a virtualhost for cadaver to below:

<VirtualHost *:80>
49     ServerName localhost
50     Include /etc/apache2/vhosts.d/default_vhost.include
51     DocumentRoot /var/www/localhost/htdocs/webdav/
52     <Directory /var/www/localhost/htdocs/webdav>
53       Options Indexes Multiviews
54       AllowOverride None
55       Order Allow deny
56       Allow from all
57     </Directory>

Alias /webdav /var/www/localhost/htdocs/webdav
61    <Location /webdav>
62      DAV on
63      AuthType Basic
64      AuthName "webdav"
65      AuthUserFile /var/www/localhost/htdocs/webdav/passwd.dav
66      Require valid-user
67    </Location>

58  </Virtualhost>

Adding a user and password to operate with cadaver:

bhaskar@bhaskar-laptop_11:31:59_Fri Sep 24:/etc/apache2/vhosts.d> sudo /usr/sbin/htpasswd2
-c /var/www/localhost/htdocs/webdav/passwd.dav cadaver
New password:
Re-type new password:
Adding password for user cadaver

And change the permission of that file like below:

bhaskar@bhaskar-laptop_11:35:20_Fri Sep 24:/var/www/localhost/htdocs/webdav>sudo chown
 root:apache passwd.dav

Now restarted the apache like this:

bhaskar@bhaskar-laptop_11:51:30_Fri Sep 24:~> sudo /etc/init.d/apache2 start
 * Starting apache2 ...                                                                                                                                                     [ ok ]

Now to test the cadaver commandline client..see below:

bhaskar@bhaskar-laptop_11:55:52_Fri Sep 24:~> cadaver http://bhaskar-laptop/webdav

Authentication required for webdav on server `bhaskar-laptop’:

Username: cadaver



dav:/webdav/> help

Available commands:

ls         cd         pwd        put        get        mget       mput

edit       less       mkcol      cat        delete     rmcol      copy

move       lock       unlock     discover   steal      showlocks  version

checkin    checkout   uncheckout history    label      propnames  chexec

propget    propdel    propset    search     set        open       close

echo       quit       unset      lcd        lls        lpwd       logout

help       describe   about

Aliases: rm=delete, mkdir=mkcol, mv=move, cp=copy, more=less, quit=exit=bye


Now you can use it like ftp thing .

Hope this will help.



About unixbhaskar
GNU/Linux Consultant

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: