Skip to content

SSH User and Key Management

Managing users and more importantly SSH keys across numerous Linux systems can be the bane of any sysadmin’s life. There are tools out there which make this easier, however some don’t work very well, some are complicated and others are costly. All of them tend to require additional software installing and being configured.

Essentially there is a simple solution, have the user’s SSH public keys stored in a remote location and have a script which downloads them and creates/deletes user accounts based on if the SSH key exists or not.

The script is written to get user list and download SSH public keys from an AWS S3 bucket. This however could be changed to get this user list and SSH keys from any remote system or location such as a SFTP server, just change it to your needs.

Instructions

  • Download the sync_ssh_users zip file below
  • Extract the zip file to get the sync_ssh_users script
  • Edit the script to set relevant values for the parameters surrounded by { and }
  • Upload the script to your Linux server and setup a cron job
  • Install the AWS cli on your Linux server
  • If required you can configure the user group in a sudoers file to allow elevating of permissions

Published inLinuxAWS

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.