Create Linux users from list of SSH keys.
Tool to create users on Linux system.
Mechanism of users creation are inspired by Google Cloud, when username are automatically taken from SSH-key(and email after).
List of users are need to be provided in the authorized_keys file format.
Tool don't use any external libraries, but relies on some default(in most Linux distros) CLI tools:
id
- used to check, if user exist in the system, get user's gid and uid
useradd
- used for user creationvisudo
- used for validation of sudoers linesssh-rsa aaaaaaaaaaaaaaaaaaaaaa [email protected]
ssh-rsa bbbbbbbbbbbbbbbbbbbbbb [email protected]
ssh-rsa cccccccccccccccccccccc [email protected]
ssh-rsa cccccccccccccccccccccc [email protected]
cruser -file users
will be:
test ALL=(ALL) NOPASSWD:ALL
added to the file /etc/sudoers.d/test
hello ALL=(ALL) NOPASSWD:ALL
added to the file /etc/sudoers.d/hello
make build
make demo