trinity-users@lists.pearsoncomputing.net

Message: previous - next
Month: November 2012

Re: [trinity-users] SED and PAM

From: Neil Youngman <ny@...>
Date: Wed, 28 Nov 2012 20:09:04 +0000
On Wednesday 28 November 2012 02:55:48 Kate Draven wrote:
> Hi
>
> I know this isn't exactly a Trinity-centric question but it will
> eventually apply to it as I switch from KDE3 to TDE. So please bare
> with me.
>
> Does anyone have any experience with SED and PAM?
> I need to replace the default admin user (arklinux) with 2 new users.
>
> I normally use sed -i -e 's,arklinux,NewUser,g' /etc/pam.d/* to change
> the admin user in PAM.
>
> How to a pose it so it adds two more users?

Something like this?

$ sed -i.bak -e 's/\(.*\)arklinux\(.*\)/\1NewUser1\2\
\1NewUser2\2/' /etc/pam.d/*

The obvious limitation on that is it will probably only work where arklinux 
appears once on a line. Multiple occurrences would need a bit more 
thought.

Test carefully before use and note the -i.bak to backup the originals in 
case of mistakes.

HTH

Neil Youngman