[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Login possible only with root



Valerio Pachera skrev:
> I created a new user (student4) with LWAT and I notice that its home
> directory HAS BEEN CREATED!
> I aspected that the script was going to fail as before but it didn't.
> That means the problem was "only" that WAS MISSING THE DIRECTORY TREE
> "/skole/tjener/home0/".

That explains, Yes, lwat expects that the parent directory of the user
homedir exists, and is writable by root.

> I tried to deleted the home direcoty I created manualy for the user
> studend1,2,3 and waited the script...
> the script didn't recreate the home directories.
> That means it doesn't check if the directory exist for each users, but
> check only if new users are created.

Not quite. It checks if the there are users created the last 15 minutes,
and if there is, checks if their homedirectories are created.

> I removed the users student1,2,3, then I created ather 3 users:
> studentA,B;C and waited the script
> Aug 29 22:40:01 tjener /USR/SBIN/CRON[11122]: (root) CMD
> (/usr/share/lwat/scripts/createhomedir)
> 
> It created the directories as aspected
> tjener:~# ls -l /skole/tjener/home0/
> totale 16
> drwxr-xr-x 8 student4 student4 4096 2007-08-29 22:27 student4
> drwxr-xr-x 2 studentA studentA 4096 2007-08-29 22:40 studentA
> drwxr-xr-x 2 studentB studentB 4096 2007-08-29 22:40 studentB
> drwxr-xr-x 2 studentC studentC 4096 2007-08-29 22:40 studentC
> 
> After that I deleted the user "student4" (created few minutes ago)
> with LWAT and waited the script...the HOME DIRECTORY HASN'T BEEN
> DELETED!

I guess that was because it was less than 15 minutes ago the homedir was
created...

> I think the script should manage also the home directory deltion
> because it can cause BIG CAOS to have home directories of not yet
> existing users.

Yes, there could be a check if there are directories that doesn't belong
to anyone. But I dont want tp write such a script.

it's something like
 #!/bin/sh
 HOMEPARENTS="/skole/tjener/home0
              /skole/tjener/teachers
              /skole/tjener/somefile"
 for HOMEPARENT in $HOMEPARENTS ; do
     find $HOMEPARENT -maxdepth 1 -type d -nouser -exec rm -rf {} \;
 done

Put that one as /etc/cron.hourly/deletehomes

and the homedirs without an owner will be deleted every hour...

> I hope that what I worte can be usefully.

Not new knowledge to me, but maybe to others. I'll have a look if the
cronscript is documented in the lwat-package

-- 
Finn-Arne Johansen
faj@bzz.no http://bzz.no/
EE2A71C6403A3D191FCDC043006F1215062E6642 062E6642



Reply to: