Rename user - file/dir ownership?

ben darby ben at cvrse.com
Tue Nov 21 06:03:18 UTC 2006


* Erik Christiansen wrote:
> On Mon, Nov 20, 2006 at 10:58:41PM -0500, Dave M wrote:
> > I need to rename a user (or delete an old user and replace it with a new 
> > one) but I want to keep the old users /home/username directory tree intact 
> > and re-assign it to the new user. What is the best way to do this so that 
> > all of ownership/permissions are transferred to the new user?
> 
> usermod -l newname oldname                   # For just what you ask, or
> 
> mv /home/oldname /home/newname               # if home dir rename is useful.
> usermod -d /home/newname -l newname oldname
> 
> should just about do it. Now, ls -lR /home/newname should show
> everything belongs to newname. (If I haven't forgotten something. :-)

i knew that command was around somewhere just couldnt remember the name, bit
easier than doing it manually :) only thing i can see u forgot was to change
the users default group

sudo groupmod -n newname oldname

-- 
ben darby
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20061121/bfe9aa56/attachment.pgp>


More information about the ubuntu-users mailing list