Home dir already exists on password change?

11 posts / 0 new
Last post
#1 Wed, 05/20/2009 - 08:37
daves

Home dir already exists on password change?

I am trying to reset the password on some accounts and I get the error:

Failed to save mailbox : Home directory /mnt/sdb1/home/domain.com/homes/testaccount already exists

I am running version 3.68 GPL, and have restored from a backup. I'm running Ubuntu 8.04 LTS.

I don't understand why it matters if the user home directory exists on saving the password?

Anyone have any ideas? I'm not sure where to begin.

Thanks :)

Wed, 05/20/2009 - 10:49
Joe
Joe's picture

Does it help if you upgrade to Virtualmin 3.69? I seem to recall fixing some bugs in this area in this release.

Also, does this user have a regular automatic home directory, or a custom directory under public_html or something?

--

Check out the forum guidelines!

Fri, 05/22/2009 - 05:00 (Reply to #2)
daves

Sorry for the delay, I need to back everything up and make sure everything else was right before the update.

All users have home dirs under /home/domain.com/homes/firstpartofemailaddy

/home is actually a link to /mnt/sdb1/home, as webmin/virtualmin picked up on as you can see from the error.

I updated it to 3.69 GPL and attempted to reset the password on an account and got the same error:

Failed to save mailbox : Home directory /mnt/sdb1/home/domain.com/homes/testaccount already exists

Also after some experimenting I have found that there are no problems resetting the password on accounts that have not yet received email since the home dir does not exist yet.

Sun, 06/07/2009 - 07:55 (Reply to #3)
Joe
Joe's picture

Ok, it is that symlink that is confusing Virtualmin into thinking that the home directory has been renamed when it really hasn't. The fix (till the next release) is to apply the following patch to virtual-server/save_user.cgi :

Index: save_user.cgi
===================================================================
--- save_user.cgi (revision 5866)
+++ save_user.cgi (working copy)
@@ -507,6 +507,7 @@
if (-e $home &&
&simplify_path($user->{'home'}) ne
&simplify_path($home) &&
+ $user->{'home'} ne $home &&
!$user->{'nocreatehome'}) {
&error(&text('user_emkhome', $home));
}

--

Check out the forum guidelines!

Sun, 06/07/2009 - 07:55 (Reply to #4)
daves

I'm not sure why but:

root@postal:/usr/share/webmin/virtual-server# patch < save_user.patch
patching file save_user.cgi
Hunk #1 FAILED at 507.
1 out of 1 hunk FAILED -- saving rejects to file save_user.cgi.rej

Contents of save_user.cgi.rej:

***************
*** 507,512 ****
if (-e $home &&
&simplify_path($user->{'home'}) ne
&simplify_path($home) &&
!$user->{'nocreatehome'}) {
&error(&text('user_emkhome', $home));
}
--- 507,513 ----
if (-e $home &&
&simplify_path($user->{'home'}) ne
&simplify_path($home) &&
+ $user->{'home'} ne $home &&
!$user->{'nocreatehome'}) {
&error(&text('user_emkhome', $home));
}

So I manually added the line: $user->{'home'} ne $home &&

at line 510 bumping the current 510 down, tried resetting a pass and got the same error.

Am I being retarded somewhere?

And I really to appreciate you taking the time to help btw :)

Sun, 06/07/2009 - 07:55 (Reply to #5)
daves

I'm not sure why but:

root@postal:/usr/share/webmin/virtual-server# patch < save_user.patch
patching file save_user.cgi
Hunk #1 FAILED at 507.
1 out of 1 hunk FAILED -- saving rejects to file save_user.cgi.rej

Contents of save_user.cgi.rej:

***************
*** 507,512 ****
if (-e $home &&
&simplify_path($user->{'home'}) ne
&simplify_path($home) &&
!$user->{'nocreatehome'}) {
&error(&text('user_emkhome', $home));
}
--- 507,513 ----
if (-e $home &&
&simplify_path($user->{'home'}) ne
&simplify_path($home) &&
+ $user->{'home'} ne $home &&
!$user->{'nocreatehome'}) {
&error(&text('user_emkhome', $home));
}

So I manually added the line: $user->{'home'} ne $home &&

at line 510 bumping the current 510 down, tried resetting a pass and got the same error.

Am I being retarded somewhere?

And I really to appreciate you taking the time to help btw :)

Sat, 05/23/2009 - 08:17 (Reply to #6)
daves

I've never had a problem with symlinks in the past, but I am no expert either :). It's always been quick way to get things where you need them to be especially when there are large amounts of data involved that is difficult the throw around, or if you want serveral things to reference the same file or dir and they are not easily configured to do so otherwise.

I'm not under the gun so to speak because I can reset passwords through other means by request for a few days if need be if you want more time to look into the issue.

I'd prefer to leave the configuration as it is if Jamie thinks it is ok and he thinks he can come up with a solution, but if symlinks really are a problem and not recommended, is a possible solution to mount the drive as /home instead of under /mnt/sdb1 and symlinking the dir?

Sat, 05/23/2009 - 21:13 (Reply to #7)
Joe
Joe's picture

If you have a separate partition for the home directories, you should be able to easily mount it at /home. Just run remove the /home link, edit /etc/fstab and change /mnt/sdb1 to /home, and reboot.

--

Check out the forum guidelines!

Sat, 05/23/2009 - 02:07
sgrayban

Good example has to why you shouldn't play with symlinks like this. Especially when it comes to /home /var and /etc

Many programs do like these paths to be symlinked for any reason.

Sat, 05/23/2009 - 06:50 (Reply to #9)
Joe
Joe's picture

This does look like a Virtualmin bug though, triggered by the home directory being symlinked..

--

Check out the forum guidelines!

Tue, 01/04/2011 - 04:31
mcongosto

this bug is STILL there

Failed to save mailbox : Home directory /home/xxxxx/public_html already exists

Topic locked