Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I connect to a remote machine using SSH, by default it is not on the bash prompt. To get the bash prompt by default on login I did as below by creating a .cshrc file in my home directory:

if ($?prompt) then
        setenv SHELL /bin/bash
        exec $SHELL -login

It works well and I am getting the bash shell but I have another file as .bashrc in my home directory which gets executed when I run bash explicitly. I have done lot of customization in this file as per my requirements. Is it possible to get my .bashrc executed somehow from .cshrc or some other way?

For example I need to go connect to host B from host A, I do this:

From A -> ssh B

This brings up host B but not with a bash prompt. To get a bash prompt I created .cshrc as mentioned above but my above code snippet does not call my .bashrc script.

share|improve this question

migrated from Jun 2 '12 at 2:10

This question came from our site for professional and enthusiast programmers.

To set the login shell of a user you have to modify your /etc/passwd file, field number 7:

share|improve this answer
Note that many systems do not use /etc/passwd these days. – Paul R May 31 '12 at 15:40
I checked my user name is not in /etc/passwd. I guess the user is network user. In case if I don't want to use /etc/passwd, is there anyother way to achieve the same – user419534 May 31 '12 at 15:41
@Paul R All modern unix/linux/unix_like systems support passwd/shadow, they give you the possibility to add support for PAM,LDAP,NIS and the like... but /etc/passwd is ok too – dAm2K May 31 '12 at 15:43
@user419534 have you checked on your remote host (HOST B in your case?) – dAm2K May 31 '12 at 15:45
Yes I checked on both remote and client host. The user does not exits in /etc/passwd – user419534 May 31 '12 at 15:50

Have you tried running chsh on the remote system? It will change the default shell for your login account.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.