Hi all,
I would need a script to run only at the first login of a newly created user. And at the first time only. I did some googlework but unfortunatly... I made up it possibly had something to do with the bashrc file.
This script is some kind of info for the user ; with the possiblity to change things like name or passwd.
The environment is a debian server and bash scripting.
Thanks in advance!
I'd suggest that you drop a .profile file in their home dir, do what you need to in it, then have the last line in it copy a more 'normal' default .profile from a template back over the top once you are finished.
Alternatively, you can add the following to the default profile:
if [ `last $USER | wc -l` -lt 2 ]
then
<do first login stuff>
fi
Or, you can use a flag file. Just touch /users/home/dir/newbie when you create them ( or put the file in the skeleton dir), then have this in the default .profile
if [ -f /users/home/dir/newbie ]
then
<do first login stuff>
rm -f /users/home/dir/newbie
fi