2

I want to know how I can run bash automatically when I log into my AIX server. How can I do that without having to type bash every time I log into my AIX server?

3 Answers 3

7

You normally would run chsh (see for example Changing Shells on IBM AIX). However, if bash is not listed in these files, then you could break your login:

  • /etc/shells and
  • /etc/security/login.defs

As a workaround, you could make your shell's login initialization script run bash directly. That would work if your shell is csh, for instance, by modifying .login.

If your login shell is ksh, that is a little harder: AIX's ksh uses .profile (which is used by other shells), and does not set special variables. Something like this might work for you, in .profile:

[ $SHLVL = 1 ] && exec bash

Both ksh and bash set this variable; it should be 1 as you just log in, and incremented when you transfer to bash.

When experimenting with things like this, it is important to have a workable shell on the remote machine, and test logins using a different connection, in case there is a problem with your edits.

1
  • i have this: Current available shells: /bin/sh /bin/bsh /bin/csh /bin/ksh /bin/tsh /bin/ksh93 /usr/bin/sh /usr/bin/bsh /usr/bin/csh /usr/bin/ksh /usr/bin/tsh /usr/bin/ksh93 /usr/sbin/uucp/uucico /usr/sbin/sliplogin /usr/sbin/snappd /usr/bin/rksh /usr/bin/rksh93 ejab7330's current login shell: /usr/bin/ksh
    – Mercer
    Commented May 21, 2015 at 12:16
1

Thomas reminded me of this. I use several AIX servers and not all servers have bash. I do prefer bash though. I put this in my .profile.

case $- in
  *i*)
    # Interactive session. Try switching to bash.
    if [ -z "$BASH" ]; then # do nothing if running under bash already
      bash=$(command -v bash)
      if [ -x "$bash" ]; then
        export SHELL="$bash"
        exec "$bash"
      fi
    fi
esac
0

Otherwise is using 'smitty user' utility under root permission.
Go to "Change characteristics of a user"
Type the username and verify the value on "Initial Program" field.
On this, you can change as you consider (/usr/bin/xxxx).

Edu.

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jan 13, 2023 at 19:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .