Class: Inspec::Resources::FreeBSDUser
- Includes:
- PasswdParser
- Defined in:
- lib/resources/user.rb
Overview
FreeBSD recommends to use the ‘pw’ command for user management @see: www.freebsd.org/doc/handbook/users-synopsis.html @see: www.freebsd.org/cgi/man.cgi?pw(8) It offers the following commands:
-
adduser(8) The recommended command-line application for adding new users.
-
rmuser(8) The recommended command-line application for removing users.
-
chpass(1) A flexible tool for changing user database information.
-
passwd(1) The command-line tool to change user passwords.
Instance Attribute Summary
Attributes inherited from UnixUser
Attributes inherited from UserInfo
Instance Method Summary collapse
Methods included from PasswdParser
#parse_passwd, #parse_passwd_line
Methods inherited from UnixUser
#identity, #initialize, #parse_id_entries, #parse_value
Methods inherited from UserInfo
Methods included from Converter
Constructor Details
This class inherits a constructor from Inspec::Resources::UnixUser
Instance Method Details
#meta_info(username) ⇒ Object
368 369 370 371 372 373 374 375 376 377 |
# File 'lib/resources/user.rb', line 368 def (username) cmd = inspec.command("pw usershow #{username} -7") return nil if cmd.exit_status != 0 # returns: root:*:0:0:Charlie &:/root:/bin/csh passwd = parse_passwd_line(cmd.stdout.chomp) { home: passwd['home'], shell: passwd['shell'], } end |