[PLUG] alias users

Don Buchholz buchholz at easystreet.com
Fri Feb 6 09:06:02 UTC 2004


Josh Orchard wrote:

>I want to move some users to another user account.  So, if they had a
>user name of:
>
>josh
>
>and I want to change it to
>
>josh.orchard
>
>Is there a way I can still alias the josh account so that the user
>would have time to log in with both accounts to get email and ftp?
>
>Or is that something you can't do because if I create another user
>account it will have a different ID number and file permissons would
>be hosed.
>
>  
>
You *can* do this.  ("Do you *want* to?" is an entirely different question.)

The simplest way (for a few accounts) is to directly edit the /etc/passwd
and /etc/shadow files.  (You might want to: (a) make sure the originals are
safe, (b) no other admin is working on user accounts, and (c) no end-users
are trying to change their password while doing this work.)  If you've got
a bunch (more than 20-30), you may want to use a small script to help.

Find your entries from /etc/passwd and /etc/shadow, e.g.

   [root]#  grep ^josh /etc/passwd /etc/shadow
   /etc/passwd:josh:x:3023:3450:Josh Orchard:/home/josh:/bin/bash
   /etc/shadow:josh:$1$KruZ55qS$uxyzpNM2abcd1234b788k1:11655:0:99999:7:::

Now, contruct new lines for each file with the new username

    /etc/passwd
    -----------
  [existing]    josh:x:3023:3450:Josh Orchard:/home/josh:/bin/bash
  [new]         josh.orchard:x:3023:3450:Josh Orchard:/home/josh:/bin/bash

    /etc/shadow
    -----------
  [existing]    josh:$1$KruZ55qS$uxyzpNM2abcd1234b788k1:11655:0:99999:7:::
  [new]         
josh.orchard:$1$KruZ55qS$uxyzpNM2abcd1234b788k1:11655:0:99999:7:::

Save the files, and now both usernames have exactly the same UID, GID, home
directories, password, etc.

Now one problem you might want to think about ... what happens when "josh"
or "josh.orchard" uses the passwd(1) command to update their password?  I'm
pretty sure only one account will be changed, but not the other.





  

 





More information about the PLUG mailing list