Method: Inspec::Resources::LinuxUser#meta_info

Defined in:
lib/resources/users.rb

#meta_info(username) ⇒ Object



405
406
407
408
409
410
411
412
413
414
# File 'lib/resources/users.rb', line 405

def meta_info(username)
  cmd = inspec.command("getent passwd #{username}")
  return nil if cmd.exit_status != 0
  # returns: root:x:0:0:root:/root:/bin/bash
  passwd = parse_passwd_line(cmd.stdout.chomp)
  {
    home: passwd['home'],
    shell: passwd['shell'],
  }
end