On Fri, 2003-06-13 at 19:49, Johnie Stafford wrote:
> >>> On Fri, 13 Jun 2003 19:34:35 -0400, Technoslick <[EMAIL PROTECTED]> said:
> 
>  t> I've been looking for an answer to a question, but haven't seen anything
>  t> that helps me understand what to do...
> 
>  t> I'm running a mixture of RedHat and Mandrake machines in a Samba
>  t> supported network. Too late, I learned that the two distro's do not
>  t> default to the same starting number when first creating a user. Since I
>  t> am the only user, I have two UID's and its causing me connectivity
>  t> problems between the two distro's and Samba.
> 
>  t> I need to change the user UID from 500 to 501. From my research it
>  t> "appears" I may lose ownership, and/or home settings for that user. I
>  t> want to avoid this. 
> 
>  t> How difficult is it and what steps need to be taken to successfully
>  t> change a user's UID while preserving his home and its contents as owner?
>  t> Is this something a newbie to Linux should be able to do? Any pointers
>  t> to URL's that tell it as it is are *highly* welcomed. I especially am
>  t> interested in cautions and real-life issues that I might not see in the
>  t> information I have scanned so far.
> 
> 
> "find" is your friend. :)
> 
> The "find" command will do what you want to do. 
> 
> First, just to make sure you're only going to affect the files you
> really want to change, run this command:
> 
>         find / -uid 500 -ls
> 
> That will give you a "ls -l" like listing of all the files owned by
> the user with UID 500. If the list seems reasonable, then change the
> UID of your user (by editing /etc/passwd or whatever means works best
> for you). Then run the following command: (<username> is the login id
> of your login account)
> 
>         find / -uid 500 -exec chown <username> {} \;
> 
> When the find command runs, it will run the chown (change owner)
> command on each file that it finds, it will replace the "{}" with the
> file name. Don't forget the "\;" that is important as well.
> 
> If the listing that you got with the original command isn't what you
> were expecting, you might need to tweak the arguments to find. Do a
> "man find" for a complete description of what find can do for you.
> 
> Johnie

Here's what I ended up doing, Johnie:

I first exited to the console and logged in as root since I would be
changing the status of some files that would be operational in X. I next
changed the user's UID to 501:

# usermod -u 500 501    ; Thanks Jerry Maldonado!

Then, I applied your suggested method to convert all the files marked as
UID 500 to 501:

# find / -uid 500 -exec chown 501 {} \;

That resolved the UID problem. However...

On logging back in as user, I experienced a problem I didn't expect: GID
would also be off. It was still set to 500. So, I changed the default
group for the user to anything but its own named group, then deleted the
group that I needed the GID changed on. I recreated the group, but with
the GID as 501. Then I set the user to default to this newly formed
group. 

Now, I had to change any file on the system that was tagged as GID 500
to 501 under that same group name. I used a modified version of what you
gave me to do that:

# find / -gid 500 -exec chgrp 501 {} \;

It took a while, but when it was through, I had changed all that could
be changed over to the new GID. Incidentally, I should mention that as
the screen scrolled by with files that were changed, I saw that 'chgrp'
was trying to modify the GID to those files on the server mounted as a
share on this PC. Unfortunately, it failed to do so. A permissions issue
over the network? If I were to do this again, I think I would make sure
that no shares are mounted.

Everything seems to be as it should be under the user's new identity.
LinNeighborhood automatically sets my predefined shares almost
immediately, something I had re-invoke manually each time, even though
set to automatically do so. It would seem the mission was accomplished
and a success.

Thanks to you, Johnie (and to Jerry Maldonado for showing me how to use
'usermod'.)

T


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to