Following the instructions at this nice walkthrough here.
I have successfully configured my CentOS 6.5 Server to authenticate with my domain. Additionally, it only allows domain users of the group
domain-ssh-users to login via SSH. There is one more piece I need for my puzzle.
When a domain user logs in via SSH for the first time, a home directory is automatically created for them (as per the walkthrough I posted above). For all home directories that are created for these domain users of group
domain-ssh-users, but not for local users, I want a specific
.bash_profile to be created. The "easy" part of this is that the
.bash_profile will be identical for all
Can anyone give me any clue how to go about doing this?
Edit: Difference in environment variables between local and domain logins.
Everything is pretty much the same except for these differences (obfuscated for security).
PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/LOCALUSER/bin PWD=/home/LOCALUSER HOME=/home/LOCALUSER LOGNAME=LOCALUSER
PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/local.mydomainname.com/DOMAINUSER/bin PWD=/home/local.mydomainname.com/DOMAINUSER KRB5CCNAME=FILE:/tmp/krb5cc_gibberish_8839 HOME=/home/local.mydomainname.com/DOMAINUSER
So... um maybe this is super easy. Can I have the bash creation script use a different bash_profile dependent on whether or not the user is in
/home or in
So, I tried creating this
.bash_profile as a test and put it in the /home directories of both a local and domain user:
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi env='env' # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH if echo $env grep -q "local.mydomain.com" then umask 000 /domain/menu.sh clear;exit fi
But now when I login as either the local user or the domain user, it launches menu.sh. I'm new to this .bash_profile creation so I'm sure I'm missing something simple.