2023-05-24 22:22:11 +04:00
|
|
|
#!/usr/bin/sh
|
|
|
|
|
2023-05-24 22:58:32 +04:00
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
|
|
echo "Must run as root!" >&2;
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-05-24 22:22:11 +04:00
|
|
|
if [[ $1 ]]; then
|
|
|
|
char_num=$1;
|
|
|
|
else
|
|
|
|
char_num=64;
|
|
|
|
fi
|
|
|
|
|
2023-05-24 22:49:36 +04:00
|
|
|
cat /dev/urandom | tr -dc 'a-zA-Z0-9!@#$%^&*' | fold -w $char_num | head -n 1 \
|
|
|
|
| systemd-creds encrypt -qp --name=salt - - 2> /dev/null
|