1

I'm trying to determine what is setting the shell to csh when open a terminal and log in. From the information I've read, the default shell is set in /etc/passwd, and I see an entry in the /etc/passwd file. But when I log in, the shell is csh.

What file or process could be setting my shell to csh?

5
  • Please show the corresponding line from /etc/passwd. Please also explain how you login (ssh? GUI? Terminal window?) Commented May 4, 2023 at 16:17
  • I login w/ ssh. The line I think sets the shell to bash is root:x:0:0:root:/root:/bin/bash. But at some point in the login process the shell is changed to csh. Commented May 4, 2023 at 16:22
  • Please put that into your question so it's easily found by anyone/everyone looking to help you. You've listed the line for root. Are you really logging in as root? If not, it's irrelevant Commented May 4, 2023 at 16:26
  • Please include the output of getent passwd "$LOGNAME", grep passwd /etc/nsswitch.conf, and if your login shell (as opposed to root's) is /bin/bash or exec bash -l -o xtrace Commented May 4, 2023 at 17:27
  • First, please put additional information in your question using the edit link. Having info spread across the question and in comments makes it difficult to track. Other files to look at include /root/.profile, /root/.bash_profile, /etc/profile, and files in /etc/profile.d/. Maybe grep for csh in these locations.
    – doneal24
    Commented May 4, 2023 at 19:39

1 Answer 1

1

The default shell for a user account is typically set in the /etc/passwd file. It possible another configuration file or process is overriding this.

It is possible that your system has a global default shell set in a configuration file such as /etc/profile or /etc/bashrcor your user account has a specific shell set in a user-specific configuration file such as ~/.bashrc, ~/.profile, etc..

These files run when a user logs in, and can override the default shell set in /etc/passwd

Look for any line that set the SHELL , or that execute commands to setting the shell.

Try this commands too:

usermod -s /bin/bash YOUR_USERNAME

How to change from csh to bash as default shell

OR

chsh -s /bin/bash

This will change your default shell to bash.

You may need to log out and log back in for the change to take effect.

Change my default shell in Linux using chsh

Where do I change my shell?

Changing Shell to /bin/bash without root access via file

1
  • You might also consider, that since the OP has talked about the root account, changing the root shell could cause major problems.
    – doneal24
    Commented May 4, 2023 at 19:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .