SSH Jailed System - Restore Errors

jkirker

Verified User
Joined
Nov 22, 2012
Messages
119
Hi All,

I've done this:
http://help.directadmin.com/item.php?id=90

When my users do a restore from a backup they are receiving the following error:

Cannot Execute Your Request

Details

Error extracting /home/userdirectory/backups/backup/home.tar.gz : /bin/tar: home/userdirectory: Cannot open: File exists /bin/tar: home: Cannot utime: Operation not permitted /bin/tar: home: Cannot change mode to rwxr-xr-x: Operation not permitted /bin/tar: Exiting with failure status due to previous errors

The issue is that the jail script creates the base file structure owned by root.root however the chown/chmod done on restore is global and is trying to effect the jail created dirs.

Is there any way to update the script that runs during the restore to exclude /bin,
/etc, /home, /lib, /lib64, /sbin, /tmp, /usr, /var?

Regards,
John
 
In between posting I learned that the directory it's having trouble with is actually the /home directory.

If I manually chown it to $user.root rather than root.root the restore ends up successful.

So I changed:
73 if [ ! -e $USER_HOME/$USER_HOME ]; then
74 # Ok, we can't assume it's in /home, so create
75 # all directory paths like before, then delete the users home
76 # then create the symbolic link. If we didn't
77 # create the full path first, there might be
78 # missing directories if they've got a weird home path.
79 mkdir -p $USER_HOME$USER_HOME
80 rm -rf $USER_HOME$USER_HOME
81 ln -sf .. $USER_HOME$USER_HOME
83 fi

to this:


73 if [ ! -e $USER_HOME/$USER_HOME ]; then
74 # Ok, we can't assume it's in /home, so create
75 # all directory paths like before, then delete the users home
76 # then create the symbolic link. If we didn't
77 # create the full path first, there might be
78 # missing directories if they've got a weird home path.
79 mkdir -p $USER_HOME$USER_HOME
80 rm -rf $USER_HOME$USER_HOME
81 ln -sf .. $USER_HOME$USER_HOME
82 chown $1.root $USER_HOME/home
83 fi

And all is good in the world.

It's a hack I know - if there's a better way, please let me know. ;)

All the best,
John
 
Back
Top