Config::OpenSSH::Authkey::Entry::Options - authorized_keys entry options handler


Parse an options string:

  my $op =
  $op->set_option('from', '');
  print $op->as_string;


This module parses option strings (no-pty,from="",...) from OpenSSH authorized_keys files. It is used by Config::OpenSSH::Authkey::Entry. Consult the AUTHORIZED_KEYS FILE FORMAT section of sshd(8) for more information about these options.


new optional option string to parse

Constructor. Optionally accepts an option string to parse.

split_options option string

Accepts a string of comma separated options, and parses these into a list of hash references. In scalar context, returns a reference to the list. In list context, returns a list.


parse option string

Utility method in the event an option string was not passed to new.

get_option option name

Returns the value (or values) for a named option. OpenSSH does allow duplicate entries for options, though in most cases this method will only return a single value. Options are boolean or string value; boolean options return the name of the method, while string options return the string value. Assuming the options have been set as shown above:

  # returns 'no-agent-forwarding'
  # returns ''

In scalar context, only the first option is returned (or the empty string). In list context, a list of one (or rarely more) values will be returned (or the empty list).


Returns a list of all option names that exist in the instance.

set_option option name, optional value

Enables an option, or with an additional argument, sets the string value for that option.

  # boolean
  # string value
  $entry->set_option(from => '');

If multiple options with the same name are present in the options list, only the first option found will be updated, and all subsequent entries removed from the options list.

unset_option option name

Deletes all occurrences of the named option.


Removes all options.


Returns the options as a comma separated value list. Any option values that contain a doublequote (") that is not escaped with a backslash (\) will be escaped with a backslash.


No known bugs. Newer versions of this module may be available from CPAN.

If the bug is in the latest version, send a report to the author. Patches that fix problems or add new features are welcome.


sshd(8), ssh-keygen(1), Config::OpenSSH::Authkey::Entry


thrig - Jeremy Mates (cpan:JMATES) <jmates at>


Copyright 2010,2015,2019 by Jeremy Mates

This program is distributed under the (Revised) BSD License: