2 Commits

Author SHA1 Message Date
2da411bf9f webring 2026-05-25 12:42:22 +02:00
3e8148c75b .gnupg & .ssh was not owned by user 2026-04-01 18:05:02 +02:00
4 changed files with 22 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
[ -n "$1" ] && login=$1 || read -p "provide login: " login [ -n "$1" ] && login="$1" || read -p "provide login: " login
[ -n "$2" ] && ssh_key=$2 || read -p "provide ssh key: " ssh_key [ -n "$2" ] && ssh_key="$(echo $2)" || read -p "provide ssh key: " ssh_key
ssh_dir=/home/$login/.ssh ssh_dir=/home/$login/.ssh
mkdir -p "$ssh_dir" mkdir -p "$ssh_dir"
@@ -9,7 +9,7 @@ mkdir -p "$ssh_dir"
# add it to authorized_keys but avoid adding it twice # add it to authorized_keys but avoid adding it twice
ak=$ssh_dir/authorized_keys ak=$ssh_dir/authorized_keys
[ ! grep "$ssh_key" $ak ] && echo "$ssh_key" >> $ak echo "$ssh_key" >> $ak
# ssh wont work without it # ssh wont work without it
chmod -R 0700 /home/$login/.ssh chmod -R 0700 /home/$login/.ssh

View File

@@ -81,7 +81,7 @@ USER_CG="$CG_ROOT/$LOGIN"
mkdir "$USER_CG" mkdir "$USER_CG"
# gemini # gemini
gmi="/home/$LOGIN/public_gemini" gmi="/home/$LOGIN/public_gemini/"
mkdir -p $gmi mkdir -p $gmi
ln -s $gmi /srv/gemini/~$LOGIN ln -s $gmi /srv/gemini/~$LOGIN
@@ -90,14 +90,15 @@ cat <<EOF > $gmi/index.gmi
EOF EOF
# end gemini # end gemini
chown -R $LOGIN:$LOGIN /home/$LOGIN/
mkdir -p /home/$LOGIN/.ssh mkdir -p /home/$LOGIN/.ssh
mkdir -p /home/$LOGIN/.gnupg mkdir -p /home/$LOGIN/.gnupg
touch /home/$LOGIN/public_html/.webring
chmod 0700 /home/$LOGIN/.ssh chmod 0700 /home/$LOGIN/.ssh
chmod 0700 /home/$LOGIN/.gnupg chmod 0700 /home/$LOGIN/.gnupg
chown -R $LOGIN:$LOGIN /home/$LOGIN/
curl -X POST https://cloud.tylda.org/ocs/v1.php/cloud/users -d userid="$LOGIN" -d password="$PASS" -H "OCS-APIRequest: true" -u "$NEXTCLOUD_USER:$NEXTCLOUD_PASS" curl -X POST https://cloud.tylda.org/ocs/v1.php/cloud/users -d userid="$LOGIN" -d password="$PASS" -H "OCS-APIRequest: true" -u "$NEXTCLOUD_USER:$NEXTCLOUD_PASS"
curl -X PUT "https://cloud.tylda.org/ocs/v1.php/cloud/users/$LOGIN" -H "OCS-APIRequest: true" -u "$NEXTCLOUD_USER:$NEXTCLOUD_PASS" -d key="quota" -d value="250MB" curl -X PUT "https://cloud.tylda.org/ocs/v1.php/cloud/users/$LOGIN" -H "OCS-APIRequest: true" -u "$NEXTCLOUD_USER:$NEXTCLOUD_PASS" -d key="quota" -d value="250MB"

8
logged_users.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
top -n 1 | \
awk 'NR>4 { print $3 }' | \
tr -d ' ' | \
sort | \
uniq | \
grep -Ev "root|nginx|postfix|gitea|unrealir"

View File

@@ -1,6 +1,11 @@
#!/bin/ash #!/bin/ash
export PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
env >> /root/snap.log
which zfs >> /root/snap.log
which ash
for u in $(ls /home); do for u in $(ls /home); do
zfs snapshot tank/ROOT/homes/$u@$(date "+%Y%m%d") zfs snapshot tank/ROOT/homes/$u@$(date "+%Y%m%d") >> /root/snap.log 2>&1
zfs destroy tank/ROOT/homes/$u@$(date --date="-5 days" "+%Y%m%d") zfs destroy tank/ROOT/homes/$u@$(date --date="-5 days" "+%Y%m%d") >> /root/snap.destroy.log 2>&1
done done