widdix / aws-ec2-ssh

Manage AWS EC2 SSH access with IAM

Home Page:https://cloudonaut.io/manage-aws-ec2-ssh-access-with-iam/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

provide a variable/configuration option/something else for `useradd` command-line parameters

uberbrady opened this issue · comments

For a particular implementation of aws-ec2-ssh, I wanted to override the defaults set in /etc/defaults/useradd. I still wanted "regular" invocations of useradd to respect them, mind you, but for users added via this solution, I wanted those users to specifically live somewhere else.

Furthermore, I noticed that the shell when the users are added from this script is hard-coded to /bin/bash. I figure, we ought to default to whatever the default shell is, but perhaps allow a config variable so that we can set a different default for people added via this script?

I'm thinking some kind of config variable called USERADD_OPTIONS, and you can add things like -b /my/custom/basedir (for my particular problem when I was using a funny homedir), or maybe --shell /bin/tcsh (for those who might want a non-default shell for their aws-ec2-ssh-controlled users).

(If you wanted both, I would think you'd want something like USERADD_OPTIONS="-b /my/custom/basedir --shell /usr/bin/zsh")

I like the idea. This would also make it possible to use this script on FreeBSD/OpenBSD for example...