====== Users: environment and profiles ====== ===== User with ksh or ksh93 ===== Which files are read ? Direct connection to a user [user1@aixb007] /home/user1> set | grep PROF PROFILE1=etc_environment PROFILE2=etc_profile PROFILE3=dot_profile_user1 Using su from root: [user1@aixb007] /home/user1> set | grep PROF PROFILE1=etc_environment PROFILE2=etc_profile PROFILE3=dot_profile_user1 Using crontab of the user1: [user1@aixb007] /home/user1> cat crontab.txt PROFILE1=etc_environment Using sudo with **Defaults:oracle !env_reset** [oracle@aixb007] /home/oracle> sudo su user1 [oracle@aixb007] /home/oracle> whoami user1 [oracle@aixb007] /home/oracle> set | grep PROF PROFILE1=etc_environment PROFILE2=etc_profile PROFILE4=dot_profile_oracle [oracle@aixb007] /home/oracle> sudo su - user1 [user1@aixb007] /home/user1> whoami user1 [user1@aixb007] /home/user1> set | grep PROF PROFILE1=etc_environment PROFILE2=etc_profile PROFILE3=dot_profile_user1 Using sudo with **Defaults:oracle env_reset** [oracle@aixb007] /home/oracle> sudo su user1 [oracle@aixb007] /home/oracle> whoami user1 [oracle@aixb007] /home/oracle> set | grep PROF [oracle@aixb007] /home/oracle> sudo su - user1 [user1@aixb007] /home/user1> whoami user1 [user1@aixb007] /home/user1> set | grep PROF PROFILE1=etc_environment PROFILE2=etc_profile PROFILE3=dot_profile_user1 login as root in ksh(93) and change to bash [root@aixb007] /root> set | grep PROF PROFILE1=etc_environment PROFILE2=etc_profile PROFILE5=dot_profile_root [root@aixb007] /root> bash [root@aixb007] /root> set | grep PROF PROFILE1=etc_environment PROFILE2=etc_profile PROFILE5=dot_profile_root PROFILE7=dot_bashrc_root BASH on AIX doesn't use /etc/*bash*, nor ~/.bash_profile, **the only file specific is .bashrc** ===== Change historyfile ===== If you need to adapt your history file depending on changing owner, like su or sudo Ex of addon to **/etc/profile** ... HOSTNAME=$(/usr/bin/hostname -s) PS1="[\$LOGNAME@\$HOSTNAME]\$PWD# " export PS1 EDITOR=/usr/bin/vi export EDITOR alias ll='ls -lsa' # duration in sec 900 s = 15 min TMOUT=7200 TIMEOUT=7200 typeset -r TMOUT typeset -r TIMEOUT HISTSIZE=10000 EXTENDED_HISTORY=ON HISTTIMEFORMAT="%F %T " histdir=/var/history/${USER} mkdir -p $histdir USER1=$(who am i | awk '{print $1}') if [ "${USER1}" = "" ] then HISTFILE=$histdir/.sh_history_${USER} else HISTFILE=$histdir/.sh_history_${USER1} fi export HISTFILE typeset -r HISTSIZE # put the variable in readonly typeset -r EXTENDED_HISTORY typeset -r HISTDATEFMT trap 1 2 3