fsync
Copy a directory from this server to the same path on a remote server over SSH (rsync), using the remote root password
- Command:
/go/fsync - Category: Migration
- Required options:
<directory>,<remote-server>,<remote-password> - Output: rsync progress
- Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
/go/fsync copies a folder, with everything in it, to another server. It is useful when you move a site or its data between servers.
It connects to the remote server as root with a password, creates the same folder there if it doesn't exist, and copies the contents with rsync. Only new and changed files are sent, so you can run it again to bring the copy up to date. It can pick up after an interrupted transfer.
The files always land at the same path on the remote server as on this one. You can't choose a different destination.
Quick start
/go/fsync /home/example.com/www 203.0.113.5 'RemoteRootPassword'
Syntax
/go/fsync <directory> <remote-server> <remote-password> [port]
Options
| Argument | Required | Default | Notes |
|---|---|---|---|
<directory> |
Yes | — | The folder on this server. A trailing / is added if it is missing. Use a path without spaces. |
<remote-server> |
Yes | — | The IP address or host name of the remote server. |
<remote-password> |
Yes | — | The remote server's root password. |
[port] |
No | 22 |
The SSH port of the remote server. |
The remote server must:
- allow
rootto log in over SSH with a password (seepermitrootlogin) - have
rsyncinstalled
This server needs sshpass and rsync installed.
Output
Copying /home/example.com/www to 203.0.113.5...
sending incremental file list
index.php
4.20K 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=10/12)
...
The command prints the progress of rsync for each file. It doesn't print a message when it finishes. The exit status is the one returned by rsync (0 means success).
| Outcome | What you get |
|---|---|
| Folder doesn't exist | An error line ending in command not found (see Troubleshooting), then exit status 1. |
| Copy finished | The last rsync lines. Exit status 0. |
Every run is logged to /var/log/go/fsync.log with a timestamp and the arguments used. The log includes the password you typed.
Examples
# Copy a site's files to another server
/go/fsync /home/example.com/www 203.0.113.5 'RemoteRootPassword'
# The remote SSH server listens on port 2222
/go/fsync /home/example.com/www 203.0.113.5 'RemoteRootPassword' 2222
# Run it again later to send only what changed
/go/fsync /home/example.com/www 203.0.113.5 'RemoteRootPassword'
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Folder <directory> not exists.: command not found |
The folder doesn't exist. The message is a script bug, but it does mean the folder is missing. | Check the path. |
Permission denied |
The password is wrong, or the remote server doesn't allow root to log in with a password. |
Check the password. On the remote server, allow root login (see permitrootlogin). |
sshpass: command not found |
sshpass isn't installed here. |
Install sshpass. |
rsync: command not found on the remote side |
rsync isn't installed on the remote server. |
Install rsync there. |
Connection refused or a timeout |
Wrong IP address or port, or a firewall blocks the port. | Check the port (the 4th argument) and open it with allow on the remote server. |
| The files have the wrong owner on the remote server | The user and group IDs differ between the two servers. | Run checkid, then fix. |
| Files deleted here still exist on the remote server | rsync runs without --delete. |
Delete them on the remote server by hand. |
| The transfer stopped halfway | The connection dropped. | Run the same command again. It continues, and partly sent files are kept. |
| The copy failed for a folder with spaces | The path isn't quoted inside the script. | Use a path without spaces. |
Details
- Checks that the folder exists and adds a trailing
/to the path. - Connects to the remote server as
rootand runsmkdir -p <directory>. - Runs
rsyncto copy the contents of the folder toroot@<remote-server>:<directory>.
The rsync options:
| Option | Meaning |
|---|---|
-a |
Archive mode: copies subfolders and keeps permissions, dates, owners, and groups. |
-z |
Compresses the data while it travels. |
-l |
Copies symbolic links as links. |
-h |
Shows sizes in a readable form. |
-P |
Shows progress and keeps partly sent files, so an interrupted copy can continue. |
Because both paths end in /, the contents of the folder go into the same folder on the remote server.
Security notes
- The password is passed on the command line, so it can be seen in the process list and is saved in your shell history and in
/var/log/go/fsync.log. Delete those entries afterwards, or use SSH keys instead. - The SSH connection doesn't check the remote server's identity (
StrictHostKeyChecking=no), so the password would go to whoever answers at that address. - It logs in as
root, so keep root password logins turned off on the remote server when you aren't using this command.
Files and requirements
| Item | Used for |
|---|---|
sshpass, rsync, ssh |
Sending the password and the files. |
rsync on the remote server |
Receiving the files. |
/var/log/go/fsync.log |
The command log. |
See also
| Command | Description |
|---|---|
copy |
Copy a GoAdmio site from one server to another |
copywww |
Copy the www directory from one domain to another |
serversync |
Back up and migrate a GoAdmio server with all configurations |
mysqlsync |
Copy MySQL databases from a local to a remote server |
sslsync |
Copy domain account SSL certificates from a local to a remote server |
smtpsync |
Copy the global SMTP configuration database to a remote server |
cb |
Copy GoAdmio backups from the local server to a remote server |
permitrootlogin |
Allow root SSH login from a specific IP |