Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
sons-of-liberty authored Jul 18, 2023
1 parent 9db9694 commit ad06385
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Modulos/firstuse
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

database="/root/usuarios.db"
temp_file="/tmp/t_t_t"
user=$PAM_USER
status="$(grep -w $user $database | cut -d' ' -f4)"
days="$(grep -w $user $database | cut -d' ' -f3)"

if [ $status -eq 0 ]; then
echo $status
awk -v usr="$user" 'BEGIN{FS=OFS=" "}{$4 = ($1 == usr ? 1 : $4)}1' "$database" > "$temp_file" && mv "$temp_file" "$database"
expiration=$(date "+%Y-%m-%d" -d "+$days days")
chage -E $expiration $user
fi

0 comments on commit ad06385

Please sign in to comment.