Category Archives: passwd

Something that’s annoying

... losing your passwd/group files when you don’t have a (recent) backup.

Well, it is especially annoying when you’re connected remotely and don’t have a root shell. When you have root privileges, here’s your solution:

cd /var/db/pkg
for i in `grep useradd */+INSTALL | cut -d: -f1`; do
    env PKG_PREFIX=/usr/local/ sh $i ${i%%/*} PRE-INSTALL;
    env PKG_PREFIX=/usr/local/ sh $i ${i%%/*} POST-INSTALL;
done

Obviously that can be done in one line, I just wrapped it to make it easier to read.

You’re welcome.

Share and Enjoy: Digg del.icio.us Facebook Google Bookmarks Twitter

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.