[K12OSN] Oops! Webmin mistake! Help!

Terrell Prude', Jr. microman at cmosnetworks.com
Tue May 11 20:13:13 UTC 2004


I'm assuming that you didn't have actual data that you or others cared 
about under /home.  If you did, the prospects are not good, and you'd 
better hope your backups are good (and current).

Making that assumption, all you need do is recreate /home/username.  I'd 
do it like this:

[microman at localhost microman]$ su root
Password:
[root at localhost microman]# mkdir /home/username
[root at localhost microman]# chown username:username /home/username
[root at localhost microman]# cp -Rv /etc/skel/* /home/username
[root at localhost microman]# chown -Rv username:username /home/username


Of course, this could be automated with a little script, like so:

Make a file with all your valid usernames in it, one on each line.  Call 
it "users.txt".

Then, run this little shell script:

    #!/bin/bash
    for username in `cat users.txt`
    do
       echo "Working on "$username"..."
       mkdir /home/$username
       chown $username:$username /home/$username
       cp -Rv /etc/skel/* /home/$username
       chown -Rv $username:$username /home/$username
    done

That ought to do it.  Naturally, if you have special permissions you 
wish to apply, you can do that as well in the script.

<SOAPBOX>

This is why I prefer to do things at the command line.  It gives you 
much more control than a GUI wrapper.

</SOAPBOX>

--TP

Richard K. Ingalls wrote:

> I used a batch file to create users with webmin but forgot to specify 
> a home directory... which ended up creating several users with all of 
> them sharing /home as their home directory (instead of 
> /home/username).  Then I used the delete user batch file to get rid of 
> these new users, thinking that I'll fix the create user batch file and 
> re-run it.  OOPs!  Webmin deleted /home!!!!!!
>
> HELP!  Is there any way to recover these files?  Please?
>
> I'm an ID10T.  Thanks for any help you can give.
>
>
>






More information about the K12OSN mailing list