Michael C. Toren on 19 Aug 2005 14:29:57 -0000


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

Re: [PLUG] Re: Terminal/shell login with no password


On Thu, Aug 18, 2005 at 10:32:29PM -0400, Tom Diehl wrote:
> On Thu, 18 Aug 2005, John Von Essen wrote:
> >Use "vipw" to edit the password file when making these types of changes, 
> >DONT simply edit /etc/passwd.

[..]

> Unless you are using some ancient version of *nix the encrypted passwds
> are in /etc/shadow. Contrary to the above advice it is very possible to
> edit the files directly as long as you are careful. Besides the passwd
> file is not the one you want to edit.

Sure, it's possible, but you risk shooting yourself in the foot.

vipw(8) locks the password file using the same locking mechanism that
passwd(1), chfn(1), useradd(8), etc all do, which means you avoid
concurrent update problems.  Additionally, many implementations of vipw
will merge the appropriate fields of the passwd and shadow files together
for the editor session, and unmerge the fields and store them in the
appropriate file when you save and exit.  While the implementation of vipw
many Linux distributions include does not support this feature, it does
permit you to edit the shadow file by specifying a command line argument
("-s") while still locking the file appropriately.

-mct

-- 
perl -e'$u="\4\5\6";sub H{8*($_[1]%79)+($_[0]%8)}sub G{vec$u,H(@_),1}sub S{vec
($n,H(@_),1)=$_[2]}$_=q^{P`clear`;for$iX){PG($iY)?"O":" "forX8);P"\n"}for$iX){
forX8){$c=scalar grep{G@$_}[$i-1Y-1Z-1YZ-1Y+1ZY-1ZY+1Z+1Y-1Z+1YZ+1Y+1];S$iY,G(
$iY)?$c=~/[23]/?1:0:$c==3?1:0}}$u=$n;select$M,$C,$T,.2;redo}^;s/Z/],[\$i/g;s/Y
/,\$_/xg;s/X/(0..7/g;s/P/print+/g;eval' #     Michael C. Toren <mct@toren.net>

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug