Just a couple of suggestions... The name of the owner/group is only a lookup in /etc/passwd and /etc/group, and is for your reference, not that of the system ( except for any scripts that may have been written ), which talks numbers ( UID and GID ), so all you really need to do is update those 2 files.
There is also a vipw command. This also ensures that the file is not lost while editing - and yes it has happened to me: partition full, don't notice, processes still writing to that partition steal the disk space /etc/passwd was written in as soon as it becomes available as part of saving -> zero length /etc/passwd -> B*gg*r. Personally, I'd sudo mv /home/douglas /home/fred Then at least the problems wil start immediately the change is made, and you'll know why. The alternative of having 2 copies may cause longer term problems even though it makes the change simpler... There may also be some extended security quirks ( DACs and selinux ) to address as well. My $0.02, Steve On Thu, 11 Oct 2007 13:42:25 +1300 Douglas Royds <[EMAIL PROTECTED]> wrote: > Make a new home directory: > > sudo mkdir /home/fred > > This new directory will be owned by root:root. Change its ownership to > the user, under their old name and old groupname: > > sudo chown douglas:douglas /home/fred > > Just moving the home directory doesn't work, as there are (very likely) > symlinks in there that get broken, so we copy the whole lot over with > the archive option: > > cp -a /home/douglas /home/fred > > Now you can edit /etc/passwd, shadow, and group to replace all instances > of the old user name with the new user name. Do this from within one > sudo command, or sudo will break between the passwd and shadow file edits: > > sudo vim /etc/passwd /etc/shadow /etc/group > > Here are the vim commands you need: > > /douglas Find the old username > cwfred<ESC> Change the word to the new username > n Find it again > . Change it again > ... > :wn Write the changes to file and move to the next file > ... > :wq Write to file and quit (after the last one) > > > Alternatively, on Debian-based systems you can use the > System->Administration->Users and Groups GUI to do the rename. > > ======================================================================= > This email, including any attachments, is only for the intended > addressee. It is subject to copyright, is confidential and may be > the subject of legal or other privilege, none of which is waived or > lost by reason of this transmission. > If the receiver is not the intended addressee, please accept our > apologies, notify us by return, delete all copies and perform no > other act on the email. > Unfortunately, we cannot warrant that the email has not been > altered or corrupted during transmission. > ======================================================================= >
