LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 05-31-2005, 05:04 PM   #1
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 927

Rep: Reputation: 30
.bashrc doesn't execute on ssh login


Anyone know how to make it automatically do this? I was under the impression that .bashrc was automatically executed whenever a new bash terminal was opened, but this doesn't seem to be the case whenever I ssh in. My aliases aren't set up, my prompt isn't correct, and there's even an "echo" command in there that isn't displayed.

/var/log/messages doesn't give any clue, just says
May 31 17:59:17 localhost sshd[5022]: Accepted password for me from xx.xx.xx.xx port 3671 ssh2

Is this an sshd setting that I missed?
 
Old 05-31-2005, 05:20 PM   #2
AdaHacker
Member
 
Registered: Oct 2001
Location: Brockport, NY
Distribution: Kubuntu
Posts: 384

Rep: Reputation: 31
Re: .bashrc doesn't execute on ssh login

Quote:
Originally posted by rose_bud4201
I was under the impression that .bashrc was automatically executed whenever a new bash terminal was opened, but this doesn't seem to be the case whenever I ssh in.
Well, yes and no. The short answer is that BASH executes ~/.bashrc when you start "an interactive shell that is not a login shell." When the shell is a login shell, it starts ~/.bash_profile instead. A terminal window is not a login shell, but apparently the shell started by an SSH login is. You should refer to the "INVOCATION" section of the BASH man page for more details on what initialization files are run under what conditions. It's actually a fairly involved question.

As for getting your ~/.bashrc to always run, I just add the line
Code:
source $HOME/.bashrc
to my ~/.bash_profile to do that.

Last edited by AdaHacker; 05-31-2005 at 05:21 PM.
 
1 members found this post helpful.
Old 06-01-2005, 08:28 AM   #3
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 927

Original Poster
Rep: Reputation: 30
.bash_profile didn't exist, but I created it and added the source .bashrc line, and everything works nicely now! Thank you!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh remote login - how to source .bashrc automatically newsgroupie2003 Linux - General 2 08-16-2005 04:49 AM
.login, .bashrc or .cshrc ??? tuananhbirm Linux - General 1 01-20-2005 09:44 AM
trying to execute an expect script in .bashrc smaudlin Red Hat 2 01-02-2005 01:34 AM
SLSE9 login issue with bash.bashrc iverger Suse/Novell 0 11-18-2004 09:43 AM
.bash_profile (hence .bashrc) not executing with ssh arobinson74 Linux - General 1 10-31-2004 09:55 AM


All times are GMT -5. The time now is 12:20 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration