Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Aug 2001 16:15:33 +0200
From:      "Patrick O'Reilly" <patrick@mip.co.za>
To:        "FBSD-Q" <freebsd-questions@FreeBSD.ORG>
Subject:   RE: One for the script gurus
Message-ID:  <NDBBIMKICMDGDMNOOCAIMEFMDFAA.patrick@mip.co.za>
In-Reply-To: <20010822163649.B98728@ns2.wananchi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Wash,

try this for a start:

-------
for usr in `grep -v "^#" /etc/passwd | cut -d":" -f1`
do
    mkdir /home/${usr}   # replace /home/ with whatever base you want
    chown ${usr} /home/${usr}
done
-------

This does not take care of group ownership of the directories, but it does
exclude comment lines in passwd from being processed.

Patrick.

-----Original Message-----
From: owner-freebsd-questions@FreeBSD.ORG
[mailto:owner-freebsd-questions@FreeBSD.ORG]On Behalf Of Odhiambo
Washington
Sent: 22 August 2001 15:37
To: FBSD-Q
Subject: One for the script gurus


You have your /etc/passwd file and from it you want to create a home
directory for every user in it. I am imagining how to extract that info
from the file and use it to feed some script that would do what I want.
I am imagining some emergency situation where my /home tape backup has
goofed.
I leave it you to, please.

Thanks.

-Wash

--
Odhiambo Washington
Wananchi Online Ltd.,
wash@wananchi.com 1st Flr Loita Hse.
Tel: 254 2 313985 Loita Street.,
Fax: 254 2 313922 PO Box 10286,00100-NAIROBI,KE.

In case of doubt, make it sound convincing.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?NDBBIMKICMDGDMNOOCAIMEFMDFAA.patrick>