heim icon indicating copy to clipboard operation
heim copied to clipboard

List users available on a host

Open daladim opened this issue 4 years ago • 2 comments

I'd like to list the users "available" on a system, and get their home dirs. This is not available on heim, since heim::host::users() only lists currently logged in users

  • On windows, this is possible using NetUserEnum
  • On Linux, /etc/passwd looks suited, unless there is a better API.

I'm not sure yet what "available" means. Should we also list "special" users (SYSTEM, LOCAL_NETWORK, etc.) ? What should we list on a machine that is part of a Windows domain that has local and domain users?

I might try to implement something, but feel free to give your opinion on this first :-)

daladim avatar Mar 25 '21 17:03 daladim

Hmm, NetUserEnum does not return the profile home dir (or rather, it does but it's an empty string, according to Manage this PC > Local Users and groups > Users > > double click > Profile tab > Home folder)...

daladim avatar Mar 26 '21 16:03 daladim

It looks like using the WMI request SELECT * FROM Win32_UserProfile is a better choice

daladim avatar Apr 01 '21 13:04 daladim