File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ title : " Skift kodeord for superuser"
3+ parent : " System"
4+ source : scripts/change_superuser_password.sh
5+ parameters :
6+ - name : " Kodeord"
7+ type : " password"
8+ default : null
9+ mandatory : true
10+ - name : " Gentag kodeord"
11+ type : " password"
12+ default : null
13+ mandatory : true
14+ compatibility :
15+ - " 22.04"
16+ - " BorgerPC"
17+ - " Kiosk"
18+ ---
19+
20+ ## Beskrivelse
21+ Skift til det angivne superuser-kodeord.
22+
23+ Det er MEGET VIGTIGT at skifte fra standard-kodeordet til et andet, så snart en OS2borgerPC-maskine er færdiginstalleret.
24+
25+ Inputparametre:
26+ - Det nye kodeord
27+ - Gentag det nye kodeord
28+
29+ Regler for kodeordet:
30+ - Skal indeholde mindst 8 tegn
31+ - Kan ikke indeholde navnet på brugeren
32+ - Kan ikke være et enkelt ord fra ordbogen som fx. "bibliotek"
33+
34+ Dette script er blevet testet og virker på Ubuntu 22.04.
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env sh
2+ #
3+ # This script will change the superuser password on a OS2borgerPC machine.
4+ #
5+ # Expects exactly two input parameters
6+
7+ set -e
8+
9+ if [ $# -ne 2 ]
10+ then
11+ printf ' %s\n' " usage: $( basename " $0 " ) <password> <confirmation>"
12+ exit 1
13+ fi
14+
15+ if [ " $1 " = " $2 " ]
16+ then
17+ # change password
18+ TARGET_USER=superuser
19+ PASSWORD=" $1 "
20+
21+ # The chpasswd always return exit code 0, even when it fails.
22+ # We therefore need to check if there is a text, only failure to change the password generates text.
23+ output=$( echo " $TARGET_USER :$PASSWORD " | /usr/sbin/chpasswd 2>&1 )
24+
25+ if [ -n " $output " ]; then
26+ echo " Failed to change password. Error message: $output "
27+ exit 1
28+ fi
29+ else
30+ printf ' %s\n' " Passwords didn't match!"
31+ exit 1
32+ fi
You can’t perform that action at this time.
0 commit comments