While preparing a Linux server for general use, you might want to initialize certain aspects of the environment at the first login by the user. This article assumes that your shell is
bash starts, it executes commands from different scripts in the order given below.
1.1 Loads all
To check which shell you have, type
You may modify the files, but it is usually a good idea to have your own
custom.sh file created inside
/etc/profile.d if you want a certain script to be executed for all users.
You can use this simple script structure to execute something for the first time a user logs in.
#!/bin/bash if [ -e $HOME/.yourflag ] then echo "No steps required" else echo "Your steps go here" touch $HOME/.yourflag fi
It is a fairly simple structure as you can see and it checks if a particular flag exists.
I hope this helps!
Well, stay tuned for upcoming articles. Say hi, share this article, leave a comment or Subscribe now to stay updated through our newsletter. Also, check out our services or contact us at email@example.com for your software and consultancy requirements.