-
-
Save ilium007/3a65fa6f7c48378cfb4dec1a1a2832e3 to your computer and use it in GitHub Desktop.
Revisions
-
kennwhite revised this gist
Apr 6, 2022 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,11 +6,12 @@ adduser -D -g appuser appuser # Set a decent random password (aiming for a 256 bit security level, but better than "monkey") PW=$(head -c 32 /dev/urandom | base64) && echo -e "$PW\n$PW" | passwd appuser && unset PW # Alternatively, to echo: PW=$(head -c 32 /dev/urandom | base64) && echo -e "$PW\n$PW" | tee /dev/stderr | passwd appuser && unset PW # Results in something like this # /etc/password: appuser:x:1000:1000:appuser:/home/appuser:/bin/ash # /etc/shadow: appuser:$6$M2LLoqMEfhFOc3Qe$W.FOl61we8PIte.KDMWxifg/TVdFgPKdIuMDISH74laCtA7t3OorjOiGPLdGPbTizczPUu17EaXoH32hu1OKo1:19088:0:99999:7::: # To revert: deluser --remove-home appuser -
kennwhite revised this gist
Apr 6, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ adduser -D -g appuser appuser # Set a decent random password (aiming for a 256 bit security level, but better than "monkey") PW=$(head -c 32 /dev/urandom | base64) && echo -e "$PW\n$PW" | passwd appuser && echo $PW && unset PW -
kennwhite created this gist
Apr 6, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ #! /usr/bin/env sh # Create unprivileged Alpine linux user. Run this script as root/sudo # Don't prompt for password and make group same as username, default path & shell adduser -D -g appuser appuser # Set random password at the 256 bit security level PW=$(head -c 32 /dev/urandom | base64) && echo -e "$PW\n$PW" | passwd appuser && echo $PW && unset PW # Results in something like this # /etc/password: appuser:x:1000:1000:appuser:/home/appuser:/bin/ash # /etc/shadow: appuser:$6$M2LLoqMEfhFOc3Qe$W.FOl61we8PIte.KDMWxifg/TVdFgPKdIuMDISH74laCtA7t3OorjOiGPLdGPbTizczPUu17EaXoH32hu1OKo1:19088:0:99999:7:::