jeroenpeeters / docker-ssh

SSH Server for Docker containers ~ Because every container should be accessible
GNU General Public License v2.0
641 stars 88 forks source link

How to get ~/.bashrc auto loaded when SSH session start? #30

Open namgivu opened 7 years ago

namgivu commented 7 years ago

I try to put in prmpt color in the bashrc flke but it is not loaded automatically i.e. I have to call source ~/.bashrc manually.

namgivu commented 7 years ago

Also posted on askubuntucom https://askubuntu.com/questions/505506/how-to-get-bash-or-ssh-into-a-running-container-in-background-mode/681159#comment1478293_681159

Daniel-Beardsmore commented 6 years ago

Hm I just found the same problem. The default prompt is unhelpful as it omits the hostname, but worse, the hostname may not be set to what you need to correctly identify what the prompt relates to. Even /etc/profile.d/* is seemingly getting skipped. This means that you don't have any automatic visual cue as to what the command prompt belongs to.

I am guessing that bash is being started in such a way that it is bypassing its entire initialisation process. However, if you then type "bash", you'll find that .bashrc gets executed.

Daniel-Beardsmore commented 6 years ago

Hm I just found the same problem. The default prompt is unhelpful as it omits the hostname, but worse, the hostname may not be set to what you need to correctly identify what the prompt relates to. Even /etc/profile.d/* is seemingly getting skipped. This means that you don't have any automatic visual cue as to what the command prompt belongs to.

I am guessing that bash is being started in such a way that it is bypassing its entire initialisation process. However, if you then type "bash", you'll find that .bashrc gets executed.

It would be useful if the default prompt was "container-name: path # " too.