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

Re: Safe change of uid



Alex Samad wrote:
On Mon, May 11, 2009 at 05:29:04PM -0400, Douglas A. Tutty wrote:
On Mon, May 11, 2009 at 08:54:47AM -0500, Elmer E. Dow wrote:
Just finished a fresh Lenny install and added an account for my daughter -- and kuser assigned it uid 500 instead of 1001, which I must correct. After looking at man pages and archives, I see that kuser in the past has done well creating accounts but not modifying them. Is that still true with the version used in Lenny? Is usermod a better option for dealing with this situation or would deleting and recreating the account -- either using kuser or userdel -- be the simplest and best method?

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
(use:
# 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.

I've never used (or heard of) kuser to know why it created uid 500.

I usually (rightly or wrongly) vim /etc/passwd, then find / -uid 500 -exec
chmod 1000 "{}" \; and maybe the same if I have to change the gid.



Doug.



Let me see if I understand this correctly. Here's what it appears to me that I should do.

First I"ll use vipw to edit /etc/passwd and vipw -s to edit the shadowfile to change the uid. Then edit with vigr and vigr -s /etc/group and the shadow file to change the gid.

Now to change files out in the system:

find / -uid 500  -exec chmod 1000 "{}" \

Find files with a uid of 500 and execute the command chmod to change the uid to 1001 (I'm 1000, so my daughter will be 1001).

And finally to change the files with a gid of 500 to 1001:

find / -gid 500  -exec chmod 1001 "{}" \

Then I should do usermod -u 1001 <username>
to change the user's uid.

Is order important here?

I'm tempted to try this instead of using deluser.


-Elmer




Reply to: