-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50228b2
commit 4d6a8ba
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
title: "Skift kodeord for superuser" | ||
parent: "System" | ||
source: scripts/change_superuser_password.sh | ||
parameters: | ||
- name: "Kodeord" | ||
type: "password" | ||
default: null | ||
mandatory: true | ||
- name: "Gentag kodeord" | ||
type: "password" | ||
default: null | ||
mandatory: true | ||
compatibility: | ||
- "22.04" | ||
- "BorgerPC" | ||
- "Kiosk" | ||
--- | ||
|
||
## Beskrivelse | ||
Skift til det angivne superuser-kodeord. | ||
|
||
Det er MEGET VIGTIGT at skifte fra standard-kodeordet til et andet, så snart en OS2borgerPC-maskine er færdiginstalleret. | ||
|
||
Inputparametre: | ||
- Det nye kodeord | ||
- Gentag det nye kodeord | ||
|
||
Regler for kodeordet: | ||
- Skal indeholde mindst 8 tegn | ||
- Kan ikke indeholde navnet på brugeren | ||
- Kan ikke være et enkelt ord fra ordbogen som fx. "bibliotek" | ||
|
||
Dette script er blevet testet og virker på Ubuntu 22.04. |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env sh | ||
# | ||
# This script will change the superuser password on a OS2borgerPC machine. | ||
# | ||
# Expects exactly two input parameters | ||
|
||
set -e | ||
|
||
if [ $# -ne 2 ] | ||
then | ||
printf '%s\n' "usage: $(basename "$0") <password> <confirmation>" | ||
exit 1 | ||
fi | ||
|
||
if [ "$1" = "$2" ] | ||
then | ||
# change password | ||
TARGET_USER=superuser | ||
PASSWORD="$1" | ||
|
||
# The chpasswd always return exit code 0, even when it fails. | ||
# We therefore need to check if there is a text, only failure to change the password generates text. | ||
output=$(echo "$TARGET_USER:$PASSWORD" | /usr/sbin/chpasswd 2>&1) | ||
|
||
if [ -n "$output" ]; then | ||
echo "Failed to change password. Error message: $output" | ||
exit 1 | ||
fi | ||
else | ||
printf '%s\n' "Passwords didn't match!" | ||
exit 1 | ||
fi |