---
title: "Comment by Mahesh Vaidya on \"Users and SSH setup on AWS EC2 - Best Practices\" | Hashnode"
description: "A weakness of SSH is SSH private key never expire. We can use AuthorizedKeysCommand We can also alter ~/.authorized_keys content based on some key store. In AMI"
url: "https://hashnode.com/posts/users-and-ssh-setup-on-aws-ec2-best-practices/594e7399dab431e2eda595dd/comment/594ea4e107008bbf7ffdd4a5"
---

[Discussion](https://hashnode.com/posts/users-and-ssh-setup-on-aws-ec2-best-practices/594e7399dab431e2eda595dd)

Comment [Users and SSH setup on AWS EC2 - Best Practices](https://hashnode.com/posts/users-and-ssh-setup-on-aws-ec2-best-practices/594e7399dab431e2eda595dd)

[Mahesh Vaidya](https://hashnode.com/@forvaidya)

[Jun 24, 2017](https://hashnode.com/posts/users-and-ssh-setup-on-aws-ec2-best-practices/594e7399dab431e2eda595dd/comment/594ea4e107008bbf7ffdd4a5)

A weakness of SSH is SSH private key never expire. We can use AuthorizedKeysCommand

We can also alter ~/.authorized\_keys content based on some key store. In AMI we need to configure AuthorizedKeysCommand which will run every time before public key is compared in ~/.authorized\_keys and recreate ~/.authorized\_keys based on user uploaded keys or admin deleted keys.

this github project have implementation [github.com/widdix/aws-ec2-ssh](https://github.com/widdix/aws-ec2-ssh)
