Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
The sys-admin library is a unified, cross platform replacement for the Etc module.
gem install sys-admin
gem cert --add <(curl -Ls https://raw.githubusercontent.com/djberg96/sys-admin/main/certs/djberg96_pub.pem)
require 'sys/admin' # or sys-admin
include Sys
# Returns an Array of User objects
a = Admin.users
# Returns an Array of Group objects
g = Admin.groups
# Get information about a particular user
p Admin.get_user("nobody")
p Admin.get_user("nobody", :localaccount => true)
# Get information about a particular group
p Admin.get_group("adm")
p Admin.get_group("adm", :localaccount => true)
Admin.get_login
Returns the user name (only) of the current login.
Admin.get_user(name, options = {})
Admin.get_user(uid, options = {})
Returns a User object based on name
or uid
. The options
hash is
for MS Windows only, and allows you to restrict the search based on the
options you provide, e.g. 'domain' or 'localaccount'.
Admin.get_group(name, options = {})
Admin.get_group(gid, options = {})
Returns a Group object based on name
or uid
. The options
hash is
for MS Windows only, and allows you to restrict the search based on the
options you provide, e.g. 'domain' or 'localaccount'.
Admin.groups(options = {})
Returns an Array of Group objects.
The options
hash is for MS Windows only, and allows you to restrict the
search based on the options you provide, e.g. 'domain' or 'localaccount'.
Admin.users(options = {})
Returns an Array of User objects.
The options
hash is for MS Windows only, and allows you to restrict the
search based on the options you provide, e.g. 'domain' or 'localaccount'.
The User class has the following attributes on MS Windows systems:
The User class has the following attributes on Unix systems:
The Group class has the following attributes on MS Windows systems:
The Group class has the following attributes on Unix systems:
Admin::Error < StandardError
Raised if anything goes wrong with any of the above methods.
The Windows version now uses a win32ole + WMI approach to getting information. This means that the WMI service must be running on the target machine in order to work (which it is, by default).
The underlying implementation is similar to core Ruby's Etc implementation. But, in addition to the different interface, I use the re-entrant version of the appropriate functions when available.
The slowdown for collecting lastlog information on OSX seems to have gotten progressively worse over time. Do not be surprised by significant slowdowns if you opt to collect it.
None that I'm aware of. If you find any, please log them on the project page at:
https://github.com/djberg96/sys-admin
Apache-2.0
(C) 2005-2024, Daniel J. Berger All Rights Reserved
Daniel J. Berger
FAQs
Unknown package
We found that sys-admin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.