2

I use SSH to login to a remote machine. I can save the alias like so, in .bashrc:

alias l='ls -lla'

but when I logout and SSH in again, the alias does not exist. It is set properly, however, in .bash_profile and in .bashrc. Why is this happening? Every time I SSH, I have to do . ~/.bashrc and I do not want to do that. What can I do to fix this?

1 Answer 1

2

Check your user shell with

getent passwd ${USER}

And look at the end. If it is not /bin/bash, run

chsh -s /bin/bash

If you are a domain-defined user, it is possible your default shell is /bin/sh which might be a symlink to bash, but will not interpret your ~/.bashrc.

2
  • This solved it! So the problem was in setting of which shell to use when logging in? Oct 19, 2017 at 18:29
  • 1
    Yes, when bash is run as /bin/sh it does not interpret the ~/.bashrc. This behavior is probably documented somewhere, but in my personal experience I simply changed my user in freeipa to have /bin/bash as my default shell and then my rc file was applied.
    – bgStack15
    Oct 19, 2017 at 19:57

You must log in to answer this question.

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