Skip to content

PSA: don’t chown your entire system

Decided some time ago that I was going to attempt to install Linux From Scratch on my 2TB harddrive. Followed the instructions up until the start of Chapter 7 (the systemd version) and attempted to change ownership of the LFS system to root (so I didn’t have security issue later when the system was independent).

What I didn’t realise was that I was using a environment variable LFS=/mnt/lfs in order to refer to the LFS mount point. However, when I performed the chown command, the LFS variable wasn’t set because I had just su - to the root user… so the chown command interpreted every instance of $LFS as nothing.

Didn’t notice this, and eventually changed back to my original user and attempted to use sudo chroot: it gave me an error saying sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set. I then realised what had happened, and immediately tried to su - back into root - except the root password wasn’t being accepted.

Logged out completely, switched into a different TTY (SDDM threw an error) and logged in as root. Followed a suggestion on Stack Overflow to chmod and chown the /usr/bin/sudo file to root and writable - which worked, except my entire system was borked now.

Attempted to reinstall all packages with paru, except pacman didn’t have permissions to write to its database files, so right now I’m currently pacstrapping a new install so I can begin reinstalling :/

Thankfully I had nothing worth keeping in /home.

Edited 13 Feb 2022. We only hold this version.

312 points57 comments
Open on Reddit
About this post
Posted
Archived
Edited
Score
312 · 95% up
Kind
Text
ID
srcl0f

Author

4
posts
40
comments
0
media
View profile
No comments archived yet. Reddit counts 57.

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.