Update create/delete scripts, add rename script

rename user script added: renames user, home dir and connected files.

delete script fix with remove of not needed options (-g)

Update all scripts to exit only after all errors are shown, unless it
is a critical run error.
This commit is contained in:
Clemens Schwaighofer
2023-08-08 10:50:08 +09:00
parent 571ddcc717
commit 93224e3768
4 changed files with 251 additions and 29 deletions

View File

@@ -256,3 +256,22 @@ The script can be put into the crontab and run once a month, it prints to STDOUT
```crontab
0 2 1 * * root /root/users/bin/check_last_login.sh | mail -s "User Account check: $(hostname)"
```
## Delete users
`bin/delete_user.sh -t -b <user 1> <user 2> ...`
Deletes one or more users
- `-t` test, no action done
- `-b` do not create a backup
Unless `-b` is set the home folder and public key in /etc/ssh will be backed up.
Flags user with #DELETED-YYYYMMDD_HHmmss:id;... in the user_list.txt file
## Rename user
`bin/rename_user.sh -t -o <current user name> -n <new user name>`
Renames a user including the home directory, public key files and any other connected data.
Also updates the user_list.txt