I have a .bash_profile in my home directory, but it isn't getting run on login. If I do the following, then things seem to be as I expect:

ssh myhost
bash
source ~/.bash_profile

But normally that all happens on login. Thoughts?

link|improve this question

67% accept rate
Also make sure that you don't have a ~/.profile or ~/.bash_login, as only one of the three is sourced. (I forgot the exact order.) – grawity Sep 25 '09 at 15:20
feedback

4 Answers

up vote 19 down vote accepted
%> chsh

(enter your password and state the path to the shell you want to use)

link|improve this answer
1  
(+1) From the man page: chsh - change login shell. – nagul Sep 25 '09 at 12:20
9  
+1 - not sure why the OP decided that editing the password file was a better choice, but this is the best answer – kdgregory Sep 25 '09 at 12:51
Yeah beat me to it, this is the standard way. – John T Sep 25 '09 at 13:49
And on ubuntu the path to the shell you want to use is... /bin/bash (and /bin/sh is not the same) – Harry Wood Mar 2 at 1:01
feedback

On top of akira's answer, you can also edit your /etc/passwd file to specify your default shell.

You will find a line like this Example:

john:x:1000:1000:john,,,:/home/john:/bin/sh

the shell is specified at the end.

link|improve this answer
5  
Better to use the 'chsh' command as suggested by akira -- less chance to screw something up by mistake. – Lars Haugseth Sep 25 '09 at 13:17
4  
not to mention 'chsh' is available when you can't write to /etc/passwd – quack quixote Oct 7 '09 at 11:30
feedback

You might check your terminal program. It might be configured to run /bin/sh rather than /bin/bash

Bash executes .bash_profile only for login sessions. .bashrc is executed for all bash sessions, not only login sessions. Try sourcing .bash_profile from .bashrc (avoid circular dependency!) or configuring your terminal program to run /bin/bash -l as a shell program.

link|improve this answer
1  
terminal program has nothing to do with the problem because it is the sshd on the remote machine, which spawns the new shell. – akira Sep 26 '09 at 4:31
feedback

One alternative is to rename your startup script into .profile This file is being source by most shell

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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