backup of dir failed : Failed to open /home/USER/.virtualmin-src for writing : Permission denied

While transferring a virtual server from one host to another, I noticed that the second server had already used up the same uid. So I changed the uid/gid manually.

I also, went into httpd.conf and changed the UID/Gid for that partiulcar server to match to whatever I manually changed.

I also did the following and tried again.

`[trinitymissions@edge ~]$ chown -R trinitymissions:trinitymissions /home/trinitymissions`

chown: changing ownership of ‘/home/trinitymissions/fcgi-bin/php5.fcgi’: Operation not permitted
chown: changing ownership of ‘/home/trinitymissions/fcgi-bin/php7.0.fcgi’: Operation not permitted
chown: changing ownership of ‘/home/trinitymissions/fcgi-bin/php7.1.fcgi’: Operation not permitted
chown: changing ownership of ‘/home/trinitymissions/fcgi-bin/php7.2.fcgi’: Operation not permitted
chown: changing ownership of ‘/home/trinitymissions/fcgi-bin/php5.5.fcgi’: Operation not permitted
[trinitymissions@edge ~]$

Then, I receive this error whenever I click transfer server under virtualmin.

Transferring trinitymissions.asia to gap.a1z.us ..
Backing up to destination system ..
Creating TAR file of home directory ..
.. backup of dir failed : Failed to open /home/trinitymissions/.virtualmin-src for writing : Permission denied

.. backup to remote system failed!

.. transfer failed

I am sure I messed up the UID/GID for that particular server.

Help, I am stuck. Unable to backup the server to a second host.

Status: 
Active

Comments

Same problem here but no UID/Gid has been changed

Ilia's picture
Submitted by Ilia on Wed, 01/15/2020 - 05:59

Hi,

The reason why you can not change the ownership for those files, is because they are immutable.

You can remove immutable attribute by using FIle Manager as root user, by going to that directory, right clicking on the file (or selecting multiple files first, using * or + key on the keyboard), select at the bottom of context-menu Properties/Change attributes, then type in -i flag and click Change.

You can also do it via command line:

sudo chattr -i /home/trinitymissions/fcgi-bin/*

Run lsatt command to list what attributes are imposed on the file(s).

Hi Ilia,

So in the end I was able to go around the problem I created the file with the name .virtualmin-src and set it to 0777 permission

Ilia's picture
Submitted by Ilia on Wed, 01/15/2020 - 13:08

Assigned: Unassigned »

Even though the issue seems to be resolved, I have concerns about it. Looking more to the issue report and the error messages you reported makes me confused.

In case you would transfer virtual server with the same name, you would get an error:

Failed to transfer server : Virtual server domain-name.com is already hosted on the destination system

Can you tell us how did you manage to have this error/issue to happen? What did you do prior to that? Can you tell us more about source and destination systems?

Jamie, I ran more tests here and already found few things that don't work right. At first, let me tell you how to reproduce an issue I am talking about. 1. Transfer domain A from system A to new system B 2. Then go back to system A 3. Rename previously transferred domain A on system A to domain A.local 4. Try transferring again domain A.local from system A to system B

..and here is dangerous/bad things might happen, especially when you select Delete from this system option.

As you can expect, username and other attributes for domain A were left intact, only the name was changed on source system, and upon the transfer, you end up with an error (you can see it on the attached screenshot).

The problem: 1. Virtual server and the data actually has been deleted, while it has never been transferred to the targeted domain 2. Error messages are not printed on new line, as expected, making it hard to read

The main problem, is that in case transfer process fails - it shouldn't delete source domain unless the data is successfully transferred to the target.

The other less problematic issue, is that error messages are not printed in user-friendly, default way (with new line).

Have a look at the attached screenshot.

Hi Ilia,

Sorry for confusing you. My bad. I'm not the original person that posted the issue. I found this thread on google while searching for a problem regarding BACKUP FAILED for the same reason but in my case I did not transfer the server before.

Just posted so maybe this could help someone else as this is the only thread I found in google with the exact same problem in the file : .virtualmin-src

Thanks!