A user account has it's shell defined in passwd file as bash. I would like to change this user account's shell to tcsh for non-interactive jobs (like ssh ), but keep interactive shell to bash. Is there any way to configure this on the system?

  • You can use "ForceCommand" option in config of sshd with specified full path to new shell. However it will not restrict user from access of initial shell. Could you please elaborate what do you mean by non-interactive?
    – Navern
    Aug 27, 2014 at 15:29
  • 1
    If you intend to use tcsh for some remote scripts called by ssh, you merely can invoke tcsh in you ssh command line.
    – tonioc
    Aug 28, 2014 at 7:38

1 Answer 1


If you want login shells to use one shell, but non-login shells to use another, you can achieve this by defining the default shell for the user (in /etc/passwd) as the one that is to be used as the non-login shell (tcsh in your case), then switching to a different shell when a login shell is opened.

In your case this can be acomplished by adding this to the file named ".profile" in the users home-directory (creating it if it doesn't exist yet):

# Switch to bash for login shells
if [ ! -n "$BASH_VERSION" ]
        exec /bin/bash -l

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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