Re: Change of UID

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

 



On 19 November 2013 02:05, Rick Stevens <ricks@xxxxxxxxxxxxxx> wrote:
> On 11/18/2013 04:12 PM, Timothy Murphy issued this missive:
>
>> Tim wrote:
>>
>>>> But on re-installing the system
>>>> (which had been in operation for several years)
>>>> I found my UID had changed from 500 to 1000.
>>>>
>>>> I dealt with this by chown -R, which worked fine.
>>>
>>>
>>> I've just gone through a similar change, when installing a newer release
>>> into a LAN with mixed releases, and wanted the same usernames to have
>>> the same UIDs and GIDs, everywhere.  It just makes things so much
>>> easier.
>>>
>>> I decided to change the older release up to the newer IDs, rather than
>>> fight against the system.  So, in my case, on the older system, I:
>>>
>>> edited /etc/password to change my old UID from 500 to 1000
>>> edited /etc/group to change my old GID from 500 to 1000
>>> chown -R tim:tim /home/tim/
>>> chown tim:tim /var/spool/mail/tim
>>
>>
>> Just a note to say that I followed this advice,
>> and it worked perfectly.
>> Thank you.
>
>
> In the future, you could also do:
>
>     # find / -uid <your-old-UID> -gid <your-old-GID> -exec chown tim:tim
> \{\} \;
>
> Example:
>
>     # find / -uid 500 -gid 500 -exec chown tim:tim \{\} \;
>
> That will find any file on the system that's owned by user 500 and
> group 500 and change its ownership to user "tim", group "tim". Quite
> handy for this activity and ensures you don't miss anything.

Things to bear in mind with this method:
1. It remaps 500:500 to tim:tim. Under some circumstances you may want
to separately map groups and uids (whatever approach you take that
requires at least two commands).
2. -exec CMD OPTS '{}' ';' will call chown for each file. This can be
unnecessarily slow. The alternative -exec CMD OPTS '{}' '+' will
append multiple files to each command invocation. (I've never checked
whether there's a single invocation and suspect not as I've never seen
it run into argument length limits.)

-- 
imalone
http://ibmalone.blogspot.co.uk
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org




[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux