Toon posts:

[Suse 10.1] Alle gebruikers laten zien?

Pagina: 1
Acties:

Verwijderd

Topicstarter
Ik heb waarschijnlijk een simpel vraagje maar ik kom er zelf niet uit:

Wat is de commando in een shell om alle gebruikers te laten zien die op jouw systeem ingelogd mogen worden?

Ik ken who maar dat is alleen voor de ingelogde gebruikers, bij mij moeten alle gebruikers weergegeven worden.

Google heb ik geprobeerd maar ik kwam dus alleen who tegen :\

  • blaataaps
  • Registratie: Juli 2001
  • Niet online
Al eens in /etc/passwd gekeken?

  • UltraSub
  • Registratie: Mei 2003
  • Laatst online: 28-12-2025
of ls -l /home
kom je ook al een heel eind ;)

  • MrNGm
  • Registratie: Augustus 2004
  • Laatst online: 05-11-2025
List Logged In Unix Users

Unix has many commands to list users who are logged in.

These commands include `w`, `who`, and `users`:

$ w
9:51PM up 99 days, 5:39, 2 users, load averages: 0.83, 0.90, 0.90
USER TTY FROM LOGIN@ IDLE WHAT
will p0 c-66-164-235-73. 8:11AM - w
spencer p3 c-66-164-235-73. 8:26PM 1:24 pine

$ who
will ttyp0 Jul 26 08:11 (66.164.235.73)
spencer ttyp3 Jul 26 20:26 (66.164.235.73)

$ users
spencer will

List All Unix Users

To list all users on a Unix system, even the ones who are not logged in, look at the /etc/password file.

$ cat /etc/passwd
...
george:*:1009:1009:George Washington:/home/george:/usr/bin/bash
tom:*:1016:1016:Thomas Jefferson:/home/tom:/usr/bin/bash
al:*:1017:1017:Alexander Hamilton:/home/alex:/usr/bin/bash
...

You can use the `cut` command to only see one field from the password file.

For example, to just see the Unix user names, use the command "$ cat /etc/passwd | cut -d: -f1".

$ cat /etc/passwd | cut -d: -f1
...
george
tom
al
...

Or, to only see the GECOS field (i.e. the account holders real name), try this:

$ cat /etc/passwd | cut -d: -f5
...
George Washinton
Thomas Jefferson
Alexander Hamilton
...

Note that you will also see Unix system accounts, such as "root", "bin", and "daemon" in the /etc/passwd file. These system accounts are not Unix users.
Zie: http://www.tech-faq.com/list-unix-users.shtml

Verwijderd

Topicstarter
UltraSub schreef op vrijdag 19 januari 2007 @ 13:36:
of ls -l /home
kom je ook al een heel eind ;)
Ja inderdaad, dat is een mooie oplossing, alleen een probleempje:
Ik moet ook de dagen tot de gebruiker zijn of haar wachtwoord moet veranderen mee echo' en.
Dat gaat dus alleen via /etc/shadow denk ik.