0

On Arch Linux x64, not using any display manager/desktop env.

Is there any way to list all "real" users (the ones who can login) before the username/password login prompt?

I already know how to get a simple user list with cat /etc/passwd | grep '/home/' | awk -F: '{ print $1 }' | paste -s -d ',' | sed -e 's/,/, /g', all that's missing is to output this command at startup.

I also know of /etc/issue but it is not sourced at startup.

Much appreciated if anyone knows a way to output the command (or similar) above before the prompt!

  • Your five commands can be replaced by one: awk -F: -v ORS=', ' '$6 ~ "^/home/" { print $1; }' /etc/passwd – Hauke Laging May 15 '18 at 21:38
  • What do you mean by "but it is not sourced at startup"? – Hauke Laging May 15 '18 at 21:40
  • @HaukeLaging 1. that command removes the trailing newline which I'd like to keep :/ 2. I meant that if you put commands there they won't be run, they'll just be printed as is, is there a better wording? – Daniel Nunes May 15 '18 at 21:49
  • awk -F: -v ORS='' '$6 ~ "^/home/" { print sep $1; sep=", " }; END { print "\n" }' /etc/passwd – Hauke Laging May 15 '18 at 22:11
0

edit /etc/issue from a service.

  • or even call that awk statement referenced in the other answer in /etc/rc.local. but I question why you'd want to do this... – ivanivan May 16 '18 at 2:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.