drist

custom modules for drist configuration tool
git clone git://git.pyratebeard.net/drist.git
Log | Files | Refs | README

commit d3be5802a16a2f7b41c15e206ccb67fc12f63490
parent 2448739590dabc1f07cd8051cce09ae3c37f016c
Author: pyratebeard <root@pyratebeard.net>
Date:   Fri,  4 Nov 2022 16:45:14 +0000

new ssh keys. get group and /home/pyratebeard dynamically

Diffstat:
Mssh_keys/files/authorized_keys | 1+
Mssh_keys/script | 11+++++++----
2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/ssh_keys/files/authorized_keys b/ssh_keys/files/authorized_keys @@ -1,3 +1,4 @@ ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINbJuOGNQ5m0EJsWP7Zb33EOgz1x6VbH0iDB1N6GRDml fortkickass ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKt/wwXaosaeM5qml7SyqPmxvcNdNdpatN94nAdzcMtS wht-rht-obj ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFgI7SUwZBfva54Oh5Q00ISUFpu+XB7WT4LLgpyGqRDU artoo +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMGGLFghU6/2OmDrlz7fhIsCYGMDcSkoE5NDy6VVt95M bulette diff --git a/ssh_keys/script b/ssh_keys/script @@ -1,8 +1,11 @@ #!/bin/sh +hostname -s USERNAME="pyratebeard" +GROUP=$(/usr/bin/id -gn ${USERNAME}) +HOMEDIR=$(getent passwd ${USERNAME} | cut -d: -f6) -[ -d /home/${USERNAME}/.ssh/ ] || mkdir /home/${USERNAME}/.ssh -mv ./authorized_keys /home/${USERNAME}/.ssh/authorized_keys -chmod 600 /home/${USERNAME}/.ssh/authorized_keys -chown -R ${USERNAME}:users /home/${USERNAME}/.ssh +[ -d ${HOMEDIR}/.ssh/ ] || mkdir ${HOMEDIR}/.ssh +mv ./authorized_keys ${HOMEDIR}/.ssh/authorized_keys +chmod 600 ${HOMEDIR}/.ssh/authorized_keys +chown -R ${USERNAME}:${GROUP} ${HOMEDIR}/.ssh