Skip to main content
60 votes
Accepted

When did Unix stop storing passwords in clear text?

For the early history of Unix password storage, read Robert Morris and Ken Thompson's Password Security: A Case History. They explain why and how early Unix systems acquired most the features that are ...
Gilles 'SO- stop being evil''s user avatar
59 votes
Accepted

May I sort the /etc/group and /etc/passwd files?

You should be OK doing this: in fact, according to the article and reading the documentation, you can sort /etc/passwd and /etc/group by UID/GID with pwck -s and grpck -s, respectively.
ErikF's user avatar
  • 4,107
50 votes
Accepted

Why would /etc/passwd be used every time someone executes `ls -l` command?

The file-system directly associates the numerical UID (User ID) and GID (Group ID) values with the file, not the user name and group name (which are strings). So the ls -l command (and any other ...
igal's user avatar
  • 9,986
43 votes

May I sort the /etc/group and /etc/passwd files?

Although ErikF is correct that this should generally be okay, I do want to point out one potential issue: You're allowed to map different usernames to the same UID. If you make use of this, tools ...
hvd's user avatar
  • 2,015
41 votes
Accepted

How to find the hashing algorithm used to hash passwords?

This is documented in crypt(3)’s manpage, which you can find via shadow(5)’s manpage, or passwd(5)’s. Those links are appropriate for modern Linux-based systems; the description there is: If salt ...
Stephen Kitt's user avatar
38 votes

What is the bin user for?

bin has not properly been for anything for the entire lifetime of Linux. Like run-levels and init spawning getty because of records in /etc/inittab, the bin account was obsolete in the Unix world ...
JdeBP's user avatar
  • 69.3k
28 votes
Accepted

Why does Debian set the login shell of user sync to /bin/sync?

This is documented in /usr/share/doc/base-passwd/users-and-groups.txt.gz: sync The shell of user sync is /bin/sync. Thus, if its password is set to something easy to guess (such as ""), ...
Stephen Kitt's user avatar
18 votes
Accepted

How can I bypass Fedora's password complexity requirments?

As root you can bypass the requirements. Your example shows this happening: # passwd justincase Changing password for user justincase. New password: BAD PASSWORD: The password fails the dictionary ...
Chris Davies's user avatar
17 votes
Accepted

Using "su - " to change user gives "No passwd entry for user"

The error message is pretty much self-explanatory. It says that the user jenkins has no entry in the /etc/passwd file i.e. the user does not exist in the system. When you do any user related ...
heemayl's user avatar
  • 56.6k
17 votes
Accepted

Source of passwd error messages

The first error message is from the PAM library, see e.g. https://github.com/linux-pam/linux-pam/blob/master/libpam/pam_strerror.c const char *pam_strerror(pam_handle_t *pamh UNUSED, int errnum) { ...
Bodo's user avatar
  • 6,088
16 votes

if statement query user id in etc/passwd?

To do that in a bash loop, I suggest using read and IFS like: #!/usr/bin/env bash while IFS=':' read -r user passwd uid gid comment home shell; do if [ "$uid" -gt 1000 ] ; then echo GT $...
Stephen Rauch's user avatar
16 votes
Accepted

Why should I use `sudo` with the `passwd` command to change the password of another user?

In this particular implementation the passwd command needs to run as the root user to be able to change anyone's password. The passwd application has a piece of code that checks whether you are the ...
Chris Davies's user avatar
15 votes
Accepted

usermod to change user password is not working

The parameter given to usermod --password is expected to be the encrypted password, as returned by the crypt() function. If you look in /etc/shadow (assuming you're using local password storage) you'...
Stephen Kitt's user avatar
14 votes

if statement query user id in etc/passwd?

Instead of reading /etc/passwd directly, you should use getent passwd, that will also work if some of your users are saved in something like LDAP or such. awk should be well-suited for the colon-...
ilkkachu's user avatar
  • 141k
12 votes

Difference between ! vs !! vs * in /etc/shadow

It may also be worth noting <account>::..... meaning that there is no password required (empty password). If you are creating an ssh key-only user you could use <account>::0:0:99999:7::: ...
coolaj86's user avatar
  • 475
12 votes

Process /etc/passwd file to list all users whose home folder is in /home

You can use quotes instead of / for the regex, to avoid escaping the /: awk -F: '$6 ~ "^/home/" {print $1}' ~/Desktop/e.txt With awk, {if (foo) ... } can often be simplified to just foo {...}.
muru's user avatar
  • 73.4k
11 votes
Accepted

Process /etc/passwd file to list all users whose home folder is in /home

You may escape forward slashes as shown below: awk -F':' '$6~/^\/home\//{ print $1 }' ~/Desktop/e.txt Another trick would be using complex field separator: awk -F'[:/]' '$7=="home"{ print $1 }' ~/...
RomanPerekhrest's user avatar
11 votes

How to change *your* Linux password via a Bash script

You could use chpasswd. sudo chpasswd <<<"neubert:newpass"
JRFerguson's user avatar
  • 14.8k
11 votes

Password Policy - BAD PASSWORD: The password is just rotated old one

pam_pwquality causes this, having an exact match for the error message: case PWQ_ERROR_ROTATED: return _("The password is just rotated old one"); There does not appear to be ...
thrig's user avatar
  • 35.1k
10 votes
Accepted

What could this portion of the 'Information Security Handbook' by John M.D Hunter possibly mean?

It means that the operating system can't prevent a person from physically accessing the system, booting an externally provided operating system, and in that way accessing/altering privileged ...
Kusalananda's user avatar
  • 338k
9 votes

How is the /etc/passwd file instantiated?

For Ubuntu and Debian the base-passwd package deploys not a packaged file, which is why running dpkg -L doesn't work, but generates the file from the pre-install script /var/lib/dpkg/info/base-...
HBruijn's user avatar
  • 7,448
9 votes

Password Policy - BAD PASSWORD: The password is just rotated old one

It's probably the obscure parameter for pam_unix.so. From man 8 pam_unix: obscure Enable some extra checks on password strength. These checks are based on the "obscure" ...
telcoM's user avatar
  • 99.6k
8 votes
Accepted

Output of passwd -S command

From the manual page of passwd: -S, --status Display account status information. The status information consists of 7 fields. The first field is the user's login name. The second field ...
DopeGhoti's user avatar
  • 76.7k
8 votes

How to Create an Encrypted Password

Another way is this: openssl passwd -1 -stdin <<< password_here This does not show the password on the process list. For more options see openssl passwd --help
dashohoxha's user avatar
8 votes

Why is the root password on Linux Mint my user password?

Mint 17.3 This looks like a deliberate decision in Linux Mint. I just freshly installed Mint 17.3 on a VM, and the root account has a password set in /etc/shadow. After changing my user password, su -...
Roger Lipscombe's user avatar
8 votes
Accepted

if statement query user id in etc/passwd?

Try this: if grep -E '^[^:]*:[^:]*:[^:]{4}' /etc/passwd | grep -Evq '^[^:]*:[^:]*:1000:' The first grep searches passwd for lines with a uid of four or more digits. The second grep filters out the ...
Tom Zych's user avatar
  • 933
8 votes

Process /etc/passwd file to list all users whose home folder is in /home

Assuming e.txt is actually /etc/passwd, you should actually use getent passwd instead of parsing the file since user account information may be stored in multiple locations specified in /etc/nsswitch....
Dennis Williamson's user avatar
8 votes

When did Unix stop storing passwords in clear text?

I don't yet have a primary source, but according to this TrustedSec post (emphasis mine): Early systems stored passwords in plaintext but eventually this was replaced by more secure forms of ...
Royce Williams's user avatar
8 votes
Accepted

how do I changed the password policy in LibreElec

You can't do it with the passwd command as it will enforce rules. Use the cryptpw command it will generate an encrypted string you can then substitute back into the /etc/shadow file Here I'm ...
Brett's user avatar
  • 106
8 votes

Is a comment line allowed in /etc/passwd

The musl C library routines for processing the account database, getpwent() et al., do not permit any sort of commentary in the /etc/passwd or /etc/shadow files. The library code simply does not treat ...
JdeBP's user avatar
  • 69.3k

Only top scored, non community-wiki answers of a minimum length are eligible