Re: several questions

From: Tony Walton (tony.walton_at_s_u_n.com)
Date: 12/04/03


Date: Thu, 04 Dec 2003 13:03:52 +0000

Alex Li wrote:
>
> HI,I have several question in system administration and I hope anyone
> who knows could give me the answers
>
> 1,An existing users in the system suddenly can't log in the
> system,what will the reasons to be and what would the most likely
> reasons be?And how could I restore the users account with least loss?
>
>

Depends what the problem is. From the looks of your next question,
somebody's broken /etc/passwd or /etc/shadow. Log in as root - ONE
person, please - and run /etc/pwck to see if there's any damage to
/etc/passwd. Then fix it, which (since the passwd/shadow file may well
be too broken to use any of the tools designed for it such as
/bin/passwd and /usr/bin/usermod), may in this instance involve
hand-editing the file(s). Be CAREFUL.

>
> 2If /etc/password is edited simulteneously by several users with root
> previlege,what will the password be after all finish editing it?

(Ignoring the facts there's no such file as /etc/password and that the
password isn't stored in /etc/passwd)

This is, as they say, indeterminate. If you're using a simple text
editor like vi or dtpad that doesn't do any locking, the password will
be the one set by the last one to write the file (probably). Of course,
if two people hit "save" at almost exactly the same time, the file might
well be completely hosed as one editor starts to write it before the
other one's finished. This is asking for trouble - *don't do it*.

If you *must* edit /etc/passwd and/or /etc/shadow with a text editor, be
sure to run /etc/pwck afterwards before logging out as root; this way
you've a reasonable chance of catching gross syntax errors in the files
before you've completely burned your boats. Of course the rule of thumb
still is "don't".

Any good method to prevent
> them from editing the password at the same time and let them edit it
> one by one..?
>

"Don't give several people the root password" is one good method.
"use the tools designed to manipulate the password file" is another.
Examples are the passwd, pwconv, useradd, userdel and usermod commands.

-- 
Tony


Relevant Pages

  • Re: If you were inventing CoBOL...
    ... vi has an overtype mode - command R. ... An editor should not be an HTTP user agent or an FTP client. ... likely that some vi clones do "support" hyperlinks, ... Here are reasonable reasons to avoid vi: ...
    (comp.lang.cobol)
  • Re: Error: 17883, Severity: 1, State: 0
    ... It could be due to various reasons. ... This is a just a health detection message. ... To find the root cause, ... 818 did fix many other bugs and gave better error message and created mini dump when 17883 was generated. ...
    (microsoft.public.sqlserver.clustering)
  • Re: root login with telnetd
    ... without telneting to some user and then su - ... My reasons for this being a bad idea isn't so much from concerns about ... but it's more an issue of accountability. ... the root password on various machines. ...
    (freebsd-questions)
  • Re: fedora-list Digest, Vol 19, Issue 72
    ... >> Do not graphically login as root! ... >> mortal user you always can start applications as root if needed. ... > because he had 'good reasons', ... log in from an ASCII console and then run startx. ...
    (Fedora)
  • Re: su and X question
    ... I have set up sudo so ... those as your editor while root. ... What other editor would you have suggested? ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)