Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following settings in my configuration file: (/etc/rsnapshot.conf)


backup_script   ssh "sh /home/user/"     ./mysql

the example shows the following:

backup_script  ssh "mysqldump -A > /var/db/dump/mysql.sql"    unused2

The error I get:

ERROR: backup_script /usr/bin/ssh returned 255  

What am I doing wrong?

share|improve this question
Which configuration file? – Stephan Feb 14 '13 at 22:09
/etc/rsnapshot.conf – Tiffany Walker Feb 14 '13 at 22:11
There's some key information missing here -- at first glance: (1) We have no idea what configuration file is (what program are you configuring?) ; (2) We have no idea what backup_script is doing. ; (3) What happens when you try running the ssh portion of the process manually? -- can you update your question to tell us more about what you're trying to do? (See Also: How can I ask better questions on Server Fault – voretaq7 Feb 14 '13 at 22:11
is 'backup_script' executable? – Stephan Feb 14 '13 at 22:17
Dirvish is excellent for this: it allows pre- and post- execution scripts on the server and the client. – Andrew Feb 15 '13 at 2:02
up vote 0 down vote accepted

One possible way would be converting ssh "sh /home/user/" into a script (,here) and invoke that script.

Something like,

backup_script /path/to/ ./mysql

I'd also recommend you to try putting quotes around your entire command.

backup_script "ssh "sh /home/user/"" ./mysql

share|improve this answer
The first trick worked. – Tiffany Walker Feb 19 '13 at 19:19

rsnapshot configuration files are tab delimited. Make sure you include tabs between the backup_scrip, the ssh command, and the backup storage. If that does not work try running rsnapshot configtest to identify the problem.

Answer updated

It is more convenient to transform your backup line to the following format:

 backup_script    /dir/    backupdirectory/

Place the middle section in a shell script, make it executable and test it. In addition to this, the ssh should connect to the remote host without a password non-interactively.

share|improve this answer
yea, nothing wrong with tabs or config file – Tiffany Walker Feb 15 '13 at 5:39

The problem is something to do with ssh. From the ssh man page

ssh exits with the exit status of the remote command or with 255 if an error occurred

You should use ssh -v[vv] to get a verbose output from ssh and see what it has to say.

share|improve this answer
So the issue is probably executing the command over SSH? – Tiffany Walker Feb 19 '13 at 18:51
@TiffanyWalker: That's what it looks like just try ssh root@... and see what error you get or ssh -v[vv] ... – Iain Feb 20 '13 at 7:38

Have you set up key authentication with the remote host, or is the ssh command expecting you to type in a password interactively?

If you haven't set up passwordless authentication, then the ssh command will fail to authenticate, and hence return an error (255 seems to be the default return value for any error).

share|improve this answer
It works fine. It copies the files, just the MySQL Backup part fails – Tiffany Walker Feb 19 '13 at 1:59

I had a similar issue that was solved by making sure that there weren't tabs in the script "path".

Instead of

backup_script [tab] /bin/ssh [tab] [tab] "/usr/bin/mysqldump -uroot --all-databases > ./mysqldump.sql" [tab] ./mysql/


backup_script [tab] /bin/ssh "/usr/bin/mysqldump -uroot --all-databases > ./mysqldump.sql" [tab] ./mysql/
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.