this post was submitted on 13 Oct 2023
14 points (79.2% liked)

Linux

48208 readers
921 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
 

Here is how to disable user accounts (password and SSH login) in #Linux to prevent login via GUI, SSH, or any other method. - nixCraft

https://www.cyberciti.biz/faq/linux-delete-user-password/

top 2 comments
sorted by: hot top controversial new old
[–] backhdlp@lemmy.blahaj.zone 12 points 1 year ago (1 children)

Their TL;DR is at the bottom:

Summing up

Over time, commands have become more complex to turn off user account passwords, and the attack surface of Linux systems has also increased. The correct procedure is as follows:

  1. Stop all Linux processes owned by the user:

# killall -STOP -u

  1. Delete the user password:

# passwd -d

  1. Lockdown the user account:

# usermod -L -e 1

  1. Politely refuse a login for the user account:

# usermod -s /usr/sbin/nologin

Reversing all that is underneith the TL;DR:

How do I reverse the procedure?

First, set user login shell to /bin/bash:

# usermod -s /bin/bash

Unlock the user account:

# passwd -u

Set a new password for the user account:

# passwd

If the Linux system wasn’t rebooted and all processes weren’t killed unlock and resume all Linux processes owned by the user:

# killall -CONT -u

[–] ShortN0te@lemmy.ml 1 points 1 year ago

This should have been the actual post with a link to the source at the end.