Re: Changing user name

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

 



On Fri, Dec 17, 2004 at 11:24:11AM -0600, Ed Wilts wrote:
> On Fri, Dec 17, 2004 at 03:10:40PM +0100, Maciek R. wrote:
> > how do I change my current user name on Linux? I there a way to rename
> > it (with all folders and the whole stuf)?
> 
> Since you've already gotten 2 bad answers, here's my approach:
> 
> 1.  Assume OLDUSER is the old name
> 2.  Assume NEWUSER is the new name
> 
> # /usr/sbin/groupmod -n $NEWUSER $OLDUSER
> # /usr/sbin/usermod -l $NEWUSER -d /home/$NEWUSER $OLDUSER
> # mv /home/$OLDUSER /home/$NEWUSER
> # mv /var/spool/cron/$OLDUSER /var/spool/cron/$NEWUSER

And the mail spool dir too.  Is a maping the old user name to
the new user name needed (/etc/aliases)?

  mv /var/spool/mail/$OLDUSER /var/spool/mail/$NEWUSER 

Some consideration  for the old user names in paths
and applicaton files is needed too.  This might help.

    find /home/$NEWUSER -type f -print0 | xargs -0 grep /home/$OLDUSER

Mostly the right thing will happen but since many users stuff
hard wired paths in their startup scripts and such  there
may be a need to look harder.  Perhaps.... 

    find / -user  $OLDUSER
    find / -user  $NEWUSER | grep $OLDUSER
    
> If you have a Samba entry, you need to update this too:
> 
> # cp /etc/smbpasswd /etc/smbpasswd.backup
> # sed "s/^$OLDUSER:/$NEWUSER:/" /etc/smbpasswd > /etc/smbpasswd.tmp
> # mv /etc/smbpasswd.tmp /etc/smbpasswd

sudo, groups, login (network/ console pam stuff), sshd (AllowUsers),
SELinux policy, printer access, fetchmail, Cyrus, CDRoast, squid,
dns-admin files, httpd, squirrelmail, gui and text mail clients, grip,
CVS, rcs, cron allow/deny, cups, gaim, oo, ftp, dovecot, Oracle/
MySQL, sendmail, and more all can have historic references to the old
user by name.


-- 
	T o m  M i t c h e l l 
	spam unwanted email.
	SPAM, good eats, and a trademark of  Hormel Foods.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux