1

I'm trying to convert from a tcsh to bash. Things I have tried:

chsh

chsh -s /bin/bash

chsh: can only change local entries; use ypchsh instead

ypchsh

ypchsh /bin/bash

ypchsh: can't get local yp domain: Local domain name not set

I discovered I don't have sudo access after trying

sudo -s /bin/bash *username*

Then I tried creating a .cshrc file:

echo "I exist in .cshrc"

setenv SHELL /bin/bash
exec /bin/bash --login

When I do this however, I can't log in to my account. I enter my username and password and it looks like it's logging me in, but instead it kicks me back out to the login screen.

I know it has something to do with the last two lines, and not the file in general because I tested it again with just the echo command and I had no problems.

7
  • Have you tried editing the value in the /etc/passwd file?
    – Cyclic3
    Commented Jan 17, 2017 at 16:15
  • I looked at that file, I don't know what value you are referring to, there wasn't a value pointing to a shell that I saw, and I don't know enough to add/modify anything in that without more instruction. Commented Jan 17, 2017 at 16:31
  • Sorry, I will be more clear: The file /etc/passwd has entries for every user. Find your user, and change the last value on the line to the shell you want. This means that all the other users on your system can use /etc/sh, but only your user has the new value set as the default. This will mean that any scripts referencing /bin/sh will not break.
    – Cyclic3
    Commented Jan 17, 2017 at 16:32
  • 1
    Except I don't seem to have an entry here either. the entries are: root, bin, daemon, adm, lp, sync, sutdown, halt, mail, uucp, operator, games, gopher, ftp, nobody, dbus, rpc, usbmuxd, abrt, oprofile, vcsa, rtkit, hsqldb, avahi-autoipd, haldaemon, saslauth, postfix, rpcuser, nfsnobody, gdm, ntp, qemu, apache, mysql, pulse, sshd, tcdump, puppet, mailnull, smmsp, unbound each of these is folowed by :x:###:###: comment: /somepath:/sbin/nologin, where the # is some number Commented Jan 17, 2017 at 16:45
  • Usually users are stored in /etc/passwd, but rarely they are stored elsewhere. chsh is supposed to deal with that for you, but if it doesn't, one can use /etc/passwd manually. I do not know much about default shells past this, though. Sorry I couldn't be of more help.
    – Cyclic3
    Commented Jan 17, 2017 at 16:55

1 Answer 1

1

So I figured out that the error was coming from the exec /bin/bash --login line. When I removed that the computer worked fine and I was in bash; however it wasn't running my bash startup file that had a number of different libraries I needed. Still not sure how to get those to load (without manually running exec bin/bash) on the original machine, but I actually run on a university server so I edited the .cshrc to the following:

echo "I exist in .chshrc"

setenv SHELL /bin/bash
if ($HOSTNAME = *server name*) then
    exec /bin/bash
end if

This seems to have solved my specific problems with this, though I doubt this is a general solution for anyone having this problem.

You must log in to answer this question.

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