this post was submitted on 05 Apr 2025
28 points (100.0% liked)

Linux

52836 readers
984 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

XY: I installed bazzite and goofed up. The username is wrong and my home is /home/bazzite instead of /home/ludrol

I am trying to run usermod -l ludrol bazzite in tty3 with sudo su - but the bazzite user is logged.

Solution:
Added password to root with passwd
Logged in as root
Ran required usermod commands
Disabled root with passwd -l

top 7 comments
sorted by: hot top controversial new old
[–] [email protected] 9 points 1 day ago (1 children)

Create a new user with sudo access then log in as that user and make the change. When done delete the temp user.

[–] [email protected] 3 points 1 day ago
[–] [email protected] 5 points 1 day ago (2 children)

IDK if this will work but maybe doing exec sudo -i does the trick.

Otherwise just enable the root account and log in as root. Should be passwd -u root to unlock (passwd -l root to relock), also need to set the root password using passwd root.

[–] [email protected] 4 points 1 day ago

Thanks, I have done exactly that. (root password)

[–] [email protected] 0 points 1 day ago* (last edited 15 hours ago)

Another way to do this is sudo su -c 'this is my command'

E.g. change a fan setting on a ThinkPad with:

sudo su -c 'echo "level full-speed" > /proc/acpi/ibm/fan'

So to run a shell you could do all sorts of tricks like:

sudo su -c '/bin/bash -i' and such.

Never know when it comes in handy.

EDIT: Damn, downvoted, any reason why? It works on my machine with a locked root user or one without a PW and I made sure to test it before posting, but I'd love an explanation of why it wouldn't work if that's the reason for the downvote. Was just hoping it would be useful to somebody :/

[–] [email protected] 1 points 1 day ago* (last edited 1 day ago)

An alternative, if you have console access, to doing that root password dance, is:

  1. Drop to rescue/emergency/single-user mode.
  2. Do your changes to the user account
  3. Drop back to multiuser mode.
[–] [email protected] -1 points 1 day ago

Try: sudo pkill -KILL -u <username>

In your case sudo pkill -KILL -u bazzite

Then: sudo usermod -l ludrol bazzite