Re: Safe change of uid
On Mon, May 11, 2009 at 05:27:14PM -0500, Elmer E. Dow wrote:
> Douglas A. Tutty wrote:
>> On Mon, May 11, 2009 at 08:54:47AM -0500, Elmer E. Dow wrote:
>>> Please cc me as I am not currently subscribing to the list.
>> Since you only just created the user, I'd just go ahead and delete it
>> # cd /var/tmp
>> # deluser --remove-all-files --backup
>> then use adduser to create the new user
>> To be safe, I'd then examine the backup tarball to ensure that nothing
>> was removed accidentally, before deleting the tarball.
> From what I've read, it's like deluser in that it only deletes the user
> stuff in the home directory, so I still need to edit /etc/passwd,
> /etc/group, /etc/shadow, etc. and delete the user's group. Or is there a
> command to take care of those, too? If there is, I haven't found it yet.
> Or will adduser overwrite the previous info when I add the new user of
> the same name?
> I've read of permission problems, boot problems, etc. caused by changing
> uid so I'm a bit paranoid.
If you use deluser, you won't have to edit other files. That's what
deluser is for.
If you find any files in the backup that the user will need, you can
untar the tarball, chown them to the new user, and give them back. I
tend to use Midnight Commander (mc) for that type of thing.