There is a new version of this tutorial available for Ubuntu 18.04 (Bionic Beaver).

Maintaining Remote Web Sites With sitecopy (Debian Squeeze/Ubuntu 11.10)

Version 1.0
Author: Falko Timme
Follow me on Twitter

sitecopy is a tool for copying locally stored web sites to a remote web server (using FTP or WebDAV). It helps you to keep the remote site synchronized with your local copy by uploading modified local files and deleting remote files that have been deleted on the local computer. This tutorial shows how you can manage your remote web site from your local Debian Squeeze/Ubuntu 11.10 desktop with sitecopy.

I do not issue any guarantee that this will work for you!


1 Preliminary Note

I'm using the username falko on my local Debian Squeeze/Ubuntu 11.10 desktop (I'm logged in on my local Linux desktop as that user - please don't log in as root). The files for the remote web site are stored in the directory /home/falko/sites/ on the local computer. The remote document root is /var/www/

You can use sitecopy with FTP and WebDAV, so you should either have an FTP or a WebDAV account on the remote server. I'm using the FTP/WebDAV username defaultfalko and the password howtoforge here.


2 Installing sitecopy

sitecopy can be installed on the local desktop as follows (we need root privileges, therefore we use sudo):

sudo apt-get install sitecopy

You should now take a look at sitecopy's man page to familiarize yourself with its options:

man sitecopy


3 Configuring sitecopy

Go to your home directory on the local desktop...

cd ~

... and create the directory .sitecopy with permissions of 700 (sitecopy uses that directory to store file details):

mkdir -m 700 .sitecopy

Next create the sitecopy configuration file .sitecopyrc:

touch .sitecopyrc
chmod 600 .sitecopyrc

Open the file...

vi .sitecopyrc

... and fill in the configuration for the site. Here are two examples, one for FTP...

  username defaultfalko
  password howtoforge
  local /home/administrator/sites/
  remote ~/web/
  exclude *.bak
  exclude *~

... and one for WebDAV:

  protocol webdav
  username defaultfalko
  password howtoforge
  local /home/administrator/sites/
  remote /var/www/
  exclude *.bak
  exclude *~

(You can define a stanza for each web site you want to manage with sitecopy.)

The site directive must be followed by a name for the web site - you can freely choose one, e.g. or mysite. This name will be used later on in the sitecopy commands. The following configuration options that belong to that site must be indented!

Most of the following configuration options are self-explaining. The default protocol is FTP; if you want to use WebDAV, please specify protocol webdav. The local ditective contains the local path of the web site copy, remote contains the path of the web site on the remote server - it can be absolute or relative. If your user is chrooted (as is normally the case with FTP users), you should use a relative path (such as ~/ or ~/web). Otherwise use an absolute path.

The exclude lines are optional, they are here just to demonstrate how you can exclude files from being maintained by sitecopy.

You can find out more about sitecopy configuration on its man page:

man sitecopy


4 First Usage

Before you use sitecopy for the first time, you have to decide which of the following three scenarios matches your situation:

  1. Existing remote site and local copy, both in sync.
  2. Existing remote site, no local copy.
  3. New remote site, existing local copy.


4.1 Existing Remote Site And local Copy, Both In Sync

If both the remote site and the local copy exist and are in sync, run

sitecopy --catchup

to make sitecopy think the local site is exactly the same as the remote copy. Replace with the name of the site you use in the .sitecopyrc file.

[email protected]:~$ sitecopy --catchup
sitecopy: Catching up site `' (on in ~/web/)
sitecopy: All the files and and directories are marked as updated remotely.
[email protected]:~$


4.2 Existing Remote Site, No Local Copy

If you have no local copy of the existing remote web site, run

sitecopy --fetch

first so that sitecopy fetches the list of files from the remote server (replace with the name of the site you use in the .sitecopyrc file):

[email protected]:~$ sitecopy --fetch
sitecopy: Fetching site `' (on in ~/web/)
File: data/index.html - size 5
File: error/503.html - size 1906
File: error/502.html - size 1881
File: error/500.html - size 1851
File: error/405.html - size 1810
File: error/404.html - size 1806
File: error/403.html - size 1809
File: error/401.html - size 1806
File: error/400.html - size 1792
File: stats/.htaccess - size 116
File: robots.txt - size 24
File: index.html - size 1861
File: favicon.ico - size 7358
File: .htaccess - size 26
Directory: data/
Directory: error/
Directory: stats/
sitecopy: Fetch completed successfully.
[email protected]:~$

Then run

sitecopy --synch

to update the local site from the remote copy.

[email protected]:~$ sitecopy --synch
sitecopy: Synchronizing site `' (on in ~/web/)
Creating data/: done.
Creating error/: done.
Creating stats/: done.
Downloading data/index.html: [.] done.
Downloading error/503.html: [.] done.
Downloading error/502.html: [.] done.
Downloading error/500.html: [.] done.
Downloading error/405.html: [.] done.
Downloading error/404.html: [.] done.
Downloading error/403.html: [.] done.
Downloading error/401.html: [.] done.
Downloading error/400.html: [.] done.
Downloading stats/.htaccess: [.] done.
Downloading robots.txt: [.] done.
Downloading index.html: [.] done.
Downloading favicon.ico: [.] done.
Downloading .htaccess: [.] done.
sitecopy: Synchronize completed successfully.
[email protected]:~$


4.3 New Remote Site, Existing Local Copy

If the local copy exists, but you have an empty remote site, run

sitecopy --init

first to intialize the site. Replace with the name of the site you use in the .sitecopyrc file.

[email protected]:~$ sitecopy --init
sitecopy: Initializing site `' (on in ~/web/)
sitecopy: All the files and directories are marked as NOT updated remotely.
[email protected]:~$

Then run

sitecopy --update

to upload the local copy to the remote site:

[email protected]:~$ sitecopy --update
sitecopy: Updating site `' (on in ~/web/)
Creating stats/: done.
Creating data/: done.
Creating error/: done.
Uploading stats/.htaccess: [.] done.
Uploading data/index.html: [.] done.
Uploading error/403.html: [.] done.
Uploading error/401.html: [.] done.
Uploading error/404.html: [.] done.
Uploading error/503.html: [.] done.
Uploading error/400.html: [.] done.
Uploading error/502.html: [.] done.
Uploading error/405.html: [.] done.
Uploading error/500.html: [.] done.
Uploading index.html: [.] done.
Uploading robots.txt: [.] done.
Uploading .htaccess: [.] done.
Uploading favicon.ico: [.] done.
sitecopy: Update completed successfully.
[email protected]:~$


5 Using sitecopy

Afterwards, sitecopy usage is really easy. You can work with your local copy and update, create, and delete files. A first, but optional step is to run


to find out which files have changed locally (replace with the name of the site you use in the .sitecopyrc file):

[email protected]:~$ sitecopy
sitecopy: Showing changes to site `' (on in ~/web/)
* These items have been added since the last update:
sitecopy: The remote site needs updating (1 item to update).
[email protected]:~$

To synchronize your remote web site with your local copy (i.e. upload new and changed files to the remote server and delete files on the remote server that have been deleted locally), you simply run

sitecopy --update
[email protected]:~$ sitecopy --update
sitecopy: Updating site `' (on in ~/web/)
Uploading info.php: [.] done.
sitecopy: Update completed successfully.
[email protected]:~$

That's it! Have fun with sitecopy!


Share this page:

Suggested articles

6 Comment(s)

Add comment


By: Anonymous

Does it support SFTP?

By: Khamul

No. sitecopy does NOT support SFTP.

For this reason, it's really quite unusable. Using FTP these days is idiotic, because it sends your credentials in cleartext over the internet. Moreover, sitecopy is unmaintained and abandoned now. It hasn't had any updates in years. Someone tried to add sftp to it a long time ago, but never got it working. I recommend using "lftp" to keep your website synchronized using SFTP.

Here's a small script I copied from somewhere and modified which should help you:

PORT="2222"  #set to your site's sftp port
PASS="password"  #be sure to escape any special chars with a backslash
lftp -c "open -u $USER,$PASS sftp://$HOST:$PORT;
lcd $LCD;
cd $RCD;
mirror --reverse \
       --delete \
       --verbose \
       --exclude-glob *.swp \
       --exclude-glob .git/ \
       --exclude-glob sessions/ \
       --exclude-glob any-other-dirs-you-want-to-not-synchronize"

By: henk

There seems to be an ssh/sftp patch here:

By: david

Hi! I made a simple replacement which supports SFTP: sitedeploy

By: david


For this reason I created similar tool sitedeploy which supports transport over SFTP.


By: davide

(Sorry for my english)

In my ftp test, this line don't work:

remote ~/web/

error 450, no such file or directory

this work:

remote /web