For detailed information, see the man page for your particular distro. Append a Match block to the end of the file.
Example, require all users to use both a password AND a publickey:
# BeginGlobalExceptions Match All PasswordAuthentication yes PubkeyAuthentication yes AuthenticationMethods password,publickey # GlobalExceptionsEnd
**Be sure to restart sshd after making any config changes so they take effect.**
Automate change distribution to many systems
In order to apply this to many systems at once, the Commands function can be leveraged in the JumpCloud Administrator Console.
- Before running this across many systems, test the process on a small number of systems to manually verify desired behavior has been achieved.
- This will not work with very old versions of sshd, in testing, we found the parameters needed for the exception were not honored with OpenSSH 5.x.
- The script expects your sshd service to be called sshd, if it is not, modify lines 27 and 29 with the appropriate name of the service.
- Appending the Match block to the end of the config is one way, and does not check to see if there are conflicting Match blocks. This method should work for most implementations, but testing before mass deployment is recommended.
- The Match block in this script contains the above conditions, if there are other conditions required for your environment, change them as needed.
- Copy the contents of the script to a local file.
- In the Administrator Console, create a new command.
- Upload the file created in step 1.
- Enter the path to the file in the command for execution. This is /tmp/FILENAME by default
- Select the desired systems or system groups to apply the command to and save.
- When ready, select the new command and select 'run now'.
- This command should return exit 0. Depending on the Linux flavor, there may also be some stdout in the logs section.