Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
Centralized management system for SSH keys?

I have multiple boxes and multiple employees. Is there a program or script that allows an admin to easily add or remove ssh keys? If an employee joins or leaves my company, it would be nice to run a command to allow or revoke their ssh key across multiple boxes.

share|improve this question

migrated from stackoverflow.com Oct 21 '11 at 4:32

This question came from our site for professional and enthusiast programmers.

marked as duplicate by quanta, voretaq7 Jul 27 '12 at 19:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
serverfault.com/questions/117072/… –  quanta Oct 21 '11 at 5:50

1 Answer 1

up vote 0 down vote accepted

I think it'd be easier and you'd have better luck finding a solution that removes the users from the user list, vs trying to remove ssh keys.

By removing the user, you're revoking that user's access to the machine. Are you in a situation where this isn't possible? If not, a script like the following can be used to easily remove users from all of your machines

#!/bin/bash
ssh -t user@host 'sudo userdel -r badusername'
ssh -t user@host2 'sudo userdel -r badusername'

The -r in userdel will remove the user's home directory, which means the key will be removed as well.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.