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

Re: can't login via gdm



On Wed, Aug 11, 2021 at 02:26:43PM +0000, Morgan Read wrote:
> So, it seems that
> # find / -user 1002 -execdir chown 1003 '{}' \;
> Didn't perform as I expected...

Starting that from / is horrifying.  I would have started from /home,
and then if you suspect you have other files outside of /home that
need handling, I would have done those by hand.

(Crontabs come to mind.  You may need to chown some crontabs, if your
users have those.  Also inboxes in /var/mail if you use that, which
I don't, but which is the "standard" in Debian.)

Running that command starting from root means you're going to descend
into /proc and /sys and /run and I can't even *guess* what will happen
if you start chowning files inside those places.

In addition to starting from somewhere other than / you could change
the \; to + for efficiency.

Apart from all that, what did it do which was different from your
expectation?  Or was the behavior so enigmatic that you couldn't even
*tell* what it broke?  If that's the case, I suspect something in those
magic places (/proc or /sys or /run) got broken.

> I was attempting to modify
> # for i in `find / -user 1001`; do chown 3001 $i; done

Dear gods.  That violates at least two *major* rules of the shell.
In fact, one of those is Bash Pitfall #1 on my list.

Whoever wrote that command has no business writing shell commands, and
*definitely* shouldn't be running shell commands as root.


Reply to: