Software⏱️ 4 min read📅 2026-06-11

How to Fix: rsync error - Unexpected remote arg: root@1.2.3.4:/*

Rsync error fix for unexpected remote arg syntax issue.

Quick Answer: Remove the trailing slash (/) from the exclude path on the destination server.

The 'rsync error: Unexpected remote arg: root@1.2.3.4:/*' error occurs when using rsync to synchronize files from a source server to a destination server. This specific error message indicates that the remote server is expecting an argument in the format of 'user@host:directory', but instead, it received '/root@1.2.3.4:/*'. This can be frustrating for system administrators who rely on rsync for file migrations.

This issue arises from a misunderstanding of how rsync handles wildcards and remote directories. The error message suggests that the problem lies in the use of the wildcard '*' character in the remote directory path, which is not supported by rsync. To resolve this issue, it's essential to understand how rsync works with remote directories and adjust the command accordingly.

🔍 Why This Happens

  • The primary cause of this error is the incorrect use of wildcards in the remote directory path. In rsync, the wildcard '*' character is used to match any characters in a file name or directory name, but it's not supported when used with the colon (:), which separates the username from the hostname. This can be confusing for users who are new to using rsync.
  • Another possible cause of this error could be a misconfigured SSH connection on the destination server. If the SSH connection is not properly configured, rsync may not be able to establish a secure connection to the remote server, resulting in this error.

🚀 How to Resolve This Issue

Using the correct directory path

  1. Step 1: To fix this issue, remove the wildcard '*' character from the remote directory path. Instead of '/root@1.2.3.4:/*', use '/root@1.2.3.4:/'. This will ensure that rsync uses the correct directory path and avoids the 'Unexpected remote arg' error.
  2. Step 2: Verify that the SSH connection is properly configured on the destination server. Make sure that the SSH keys are correctly set up, and the hostname and port number are correct in the ssh_config file or the command line.

Using rsync's built-in directory traversal

  1. Step 1: Another approach to resolving this issue is to use rsync's built-in directory traversal feature. To do this, replace '/root@1.2.3.4:/*' with '/root@1.2.3.4:. rsync will then traverse the remote directory tree using the '.' wildcard, which matches any directories and subdirectories.
  2. Step 2: Note that using the '.' wildcard may not be suitable for all use cases, as it can potentially transfer unnecessary files. However, in this specific case, it should resolve the 'Unexpected remote arg' error.

💡 Conclusion

To summarize, the 'rsync error: Unexpected remote arg: root@1.2.3.4:/*' error occurs due to a misunderstanding of how rsync handles wildcards and remote directories. By removing the wildcard '*' character from the remote directory path or using rsync's built-in directory traversal feature, you should be able to resolve this issue and successfully migrate files between servers.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions