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

Re: Changing user name



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

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

-- 
Ed Wilts, RHCE
Mounds View, MN, USA
mailto:ewilts ewilts org
Member #1, Red Hat Community Ambassador Program


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