0

The AIX user I su to daily has no history from SSH session to SSH session. I'm using the bash shell because the Korn shell alternative does not autocomplete which is an even bigger nuisance.

I already put the lines in the .profile file in the home folder:

export HISTSIZE=10000
export EXTENDED_HISTORY=ON

I don't have the root password to modify /etc/profile.

When I do

ls $HISTFILE 

I get /users/me/.bash_history instead of /users/user_I_su_to/.bash_history

I also tried adding to file /users/user_I_su_to/.bash_history the line: export HISTFILE=/usagers/user_I_su_to/.bash_history

Naturally I logged out of my SSH sessions and back in to apply.

migrated from serverfault.com Mar 6 '18 at 14:24

This question came from our site for system and network administrators.

  • 1
    Is $HISTFILE set to something valid? – Jeff Schaller Mar 6 '18 at 16:46
  • ls $HISTFILE gives me /users/wronguser/.bash_history I am "wronguser", the history I want is for the user I su'ed to. I tried adding in .profile export HISTFILE=/users/suedto/.bash_history but that doesn't seem to work (?) – Bertrand_Szoghy Mar 6 '18 at 19:12
  • 2
    Burying surprises in question comments does not make for good questions or answers. Your question should mention these facts straight off the bat. – JdeBP Mar 6 '18 at 20:49
  • 1
    You can enable ksh autocompletion. set -o vi-tabcomplete and If you're using stock ksh, you can use "Esc-\" for completion. – Kiwy Mar 20 '18 at 10:58
0

Resolved this. The history is correctly displayed if I su using the syntax:

su - user_I_su_to

instead of:

su user_I_su_to

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.