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

Re: Re: can't login via gdm



On Wed, Aug 11, 2021 at 07:00:38PM +0000, Morgan Read wrote:
> > Starting that from / is horrifying.  I would have started from /home,
> 
> But, all recklessness aside - what would be the correct command to achieve the end sought?

I'm not quite sure what that "end" is.  We were never given the whole
picture.  From what I was able to piece together from the original
message, the OP had three user accounts on their system, with UIDs
1000, 1001 and 1002.  They wanted to "+1" each UID, turning UID 1002
into UID 1003, and so on down the line.  Why they wanted to do this was
never stated.

If I assume that the actual goal was "make sure all UIDs are greater
than 1000" (again... why?), an easier way to do that would have been to
change only UID 1000 to UID 1003, leaving UIDs 1001 and 1002 alone.

So, in order to change the UID of one single account on one single
system (in the absence of NIS, LDAP, or any other network-based user
database), here's how I would go about it:

1) Make sure that user is logged off.
2) Make sure that user has no processes running currently.  And ideally no
   cron jobs about to launch while you're working on this.
3) Use vipw to edit the passwd file, changing the UID 1000 to 1003.
4) cd /home && chown -R 1003 that_users_home_dir
5) Look for other files owned by that user, e.g. in /var/spool/cron/crontabs
   or /var/mail, and chown those.
6) If you're really paranoid, look for any other files owned by UID 1000
   anywhere on the system:  find / -user 1000 -ls
   If you do find any, deal with them manually.
7) Try logging in as the altered user, both on the console and by whatever
   other means are normally used (ssh, gdm3, whatever).  Make sure
   everything works.


Reply to: