Simple question about removing a user

Discussion in 'Server Operation' started by Been Told, Sep 12, 2009.

  1. Been Told

    Been Told Member

    I have just read this article:

    And my question is:
    In stop 3, instead of changing the login shell to /dev/null or whatever, could I just remove the line pertaining to that user?

    And the whole process seems strange to me. Disabling the user password and changing their shell, removing their files from the system and killing their process.
    All of that seem to me to disable the user, but doesn't actually remove them from the system. Or does it?
    Can someone enlighten me on this?
  2. Leszek

    Leszek Member

    Disabling the account before actually removing it might be usefull for other employees and are the property of the company that owns the workstation/server.
    The author just goes along his own scenario.
    After removing the user his files would get orphaned or deleted which makes it harder to find/delete them.
  3. Been Told

    Been Told Member

    Ok, but my setup is a server with only me as admin. So I can just remove the disabled users from the /etc/passwd file right?
  4. Leszek

    Leszek Member

    It's better and safer to use userdel, for example:

    userdel beentold
    will delete the user beentold without deleting his files

    userdel -r
    will do the same but will also delete his files

    If You'd like to disable the account without deleting it use usermod:

    usermod -L beentold
  5. Been Told

    Been Told Member

    Thanks, this is really helpful. I really don't like user accounts lying around even if they are disabled.

Share This Page