[Gllug] CORRECTION: Gnome3 on Fedora 16 (Again)

Stuart Sears stuart at sjsears.com
Wed Apr 18 09:49:20 UTC 2012

 Apologies for the double-posting. My idiocy with this webmail-- 
 interface :)

 On Wed, 18 Apr 2012 10:03:08 +0100, John Edwards wrote:
> On Wed, Apr 18, 2012 at 09:42:12AM +0100, John Edwards wrote:
> <snip>
>> B) Change your UID from 500 to 1001 (assuming that it UID is not
>> used), and probably also your GID as well. Likely to be safer in the
>> long term, but carries a small amount of risk to it.
>> Steps are:
>> 1) Make sure that you can login to the text console as the root 
>> user.
>> 2) Logout of everything as your normal user.
>> 3) As root run 'usermod -u 1001 <your_username>'
>> 4) As root run 'groupmod -u 1001 <your_username>'
> The "-u" option in the groupmod should of course be "-g" for GID:
> 	'groupmod -g 1001 <your_username>'
> This is assuming that RedHat/Fedora still creates a group for every
> user with the GID equal to the UID.

 They do.

>> 5) As root run 'find / -uid  -exec 501 chown 1001 "{}" \;'
> Another typo:
> 	find / -uid 501 -exec chown 1001 "{}" \;
>> 6) As root run 'find / -gid  -exec 501 chgrp 1001 "{}" \;'
> Another typo:
> 	find / -gid 501 -exec chgrp 1001 "{}" \;
>> 7) Log back in as your normal user.
> 8) Realise that you shouldn't trust code sent via the Internet.


 Indeed. Lookup the commands and check that the options do what we 
 RTFM as the old adage goes.

> ps. If you have a lot of files then the 'find' commands will take a
> long time, because chown/chgrp is called separately for every file.
> This might be speeded up by piping the list of files to xargs with
> something like:
> 	find / -gid 501 -print0 | xargs -r0 chgrp 1001
> But I sometimes meet problems with files with special characters in
> them when doing this, usually created by Windows clients via Samba.

 A few notes on the (very sensible) procedure outlined above:

 At first, I would probably only concern myself with /home/$username, 
 /tmp and /var/tmp
 as those are the only parts of the filesystem to which non-privileged 
 users have write access by default.
 That would enable you to login as the newly modified user account and 
 then use sudo or su to fix anything else.

 Also, at no point does the advice cover changing the primary GID of 
 your user to 1001, which would also be required.

 so you could just do (as root)
 1. groupmod -g 1001 yourusername
 (the group first, otherwise the following would probably complain that 
 there is no group with gid 1001)

 2. usermod -a -G 500 -u 1001 -g 1001 yourusername
 (this also adds your new user to the primary group of the old one - 
 this should allow access to
 any files that haven't been converted by the rest of the commands. You 
 do end up with an orphaned group though.)

 4. find /tmp /var/tmp /home -uid 500 -print0 | xargs -r0 chown -v 
 (the trailing : automatically uses the new user's primary group. If you 
 don't want that, don't use it. :) )

 5. find /tmp /var/tmp /home -gid 500 -print0 | xargs -r0 chgrp -v 

 6. logout of the root terminal and (probably, to be sure there are no 
 sessions lying about with the old UID/GID) reboot.

 7. login after the reboot, which should work just fine. if not, login 
 as root on the terminal and work out why :)

 Then if you want to check the entire filesystem, you can do it in a 
 graphical terminal while doing other things.

 (waiting for the mistakes that he has inevitably made to be pointed 
 Stuart Sears RHCA etc.
 "It's today!" said Piglet.
 "My favourite day," said Pooh.
Gllug mailing list  -  Gllug at gllug.org.uk

More information about the GLLUG mailing list