utorok 21. februára 2023

Gitlab for students: part 1: user-expire-password.sh

I'm just a normal lad from Kosice. I like Linux, devops and python and lot of thinks from open source world. 





My job is: I am a just normal linux administrator and I'm teaching Linux and some devops courses. Don't worry I am good guy. (Like Father Mulcahy in Mash)


For better cooperation of students, I'm using the gitlab. (For scripts, manuals and communication.) I need and want to create the communities for better learning. Please join me and let us share the information together.



https://gitlab.com/martin.suraba/script_bash_for_work 


In this blog, I will explain some bash scripts: 

Now: this: https://gitlab.com/martin.suraba/script_bash_for_work/-/blob/main/user_expire_pass.sh 

(please open this file for better explanation)




- line 3 - it is information for system (Script will be written in bash) 


- line 5 - Echo : command echo "try this: echo "Hello World" 


- line 7 - command read - (the script read your opinion) ; ludze is variable 


- line 10: 

useradd -p $(openssl passwd -1 heslo) $ludze


useradd your opinion (in line 7 as you wish)... openssl passwd -1 heslo - user get password heslo wich will be crypt. $ludze is variable from line 7


- line 12- command id - for information of user 


- line 15- 

chage -E $(date -d +30days +%Y-%m-%d) $ludze


chage -E - password will be expire 

date -d +30 days - password will be expire for 30 days

date -d +30days +%Y-%m-%d - password will be expire for 30 days from today


chage -l - command for information about expiry password, account, etc... of user. Very usefull command! 


Write the scripts and public to gitlab or github. If you want we can create some script together!


Žiadne komentáre:

Zverejnenie komentára