On 03/05/2018 06:30 PM, Bill Shirley wrote:
I've done this many times but always from root.
I've not tried it for this sort of thing, but "sudo bash -l" SHOULD make
a non-root user behave as root (including root's environment).
With no root account, I would:
1) create a 2nd user 'test', set a password, and make 'test' a sudo user
2) logout and login as 'test'
3) let's say the user to change is 'bob' with id 1000
grep bob /etc/passwd
should yield:
bob:x:1000:1000:Bob:/home/bob:/bin/bash
4) edit /etc/passwd and change the 1st number (the uid) for 'bob' from
1000 to 54321 and save
5) run:
sudo find / -xdev -uid 1000 -exec chown bob {} \;
-xdev says stay on this filesystem; don't descend into /proc or /sys
or /cdrom and so on.
This could take awhile.
6) logout from 'test' and login as 'bob'
Don't forget that many people have /home as a separate filesystem, so
an additional "find /home -xdev -uid 1000 -exec chown bob {} \;"
wouldn't be out of place. Perhaps superfluous, perhaps very necessary.
Couldn't hurt. Belt and suspenders, don't you know.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital ricks(a)alldigital.com -
- AIM/Skype: therps2 ICQ: 22643734 Yahoo: origrps2 -
- -
- "Do you suffer from long-term memory loss?" "I don't
remember" -
- -- Chumbawumba, "Amnesia" (TubThumping) -
----------------------------------------------------------------------