we are using CentOS 6.9 and one of my users has run into an error where if they login, the screen will be frozen until they press Ctrl+C. The same thing happens when they exit. It also happens when I am root, and su - as the troublesome user. The user uses tcsh but I haven't seen any other user with tcsh suffer this problem

[root@boop] # su - troublesome_user
(hangs until terminate)    
^C[troublesome_user@boop ~]$ exit
(hangs until terminate)
^C [root@boop] #

I'm most familiar with bash so I checked for .bash_profile and .bash_rc but I now know that tcsh uses a different set of .profile files. I've looked into their .cshrc files and didn't notice anything strange.

Here's the contents:

setenv LC_ALL C
set path = ($path /nfs/bin) 

Anyone have any clue if there's any feature of tcsh that might cause this?



First off, I would check all of the locations where tcsh executes commands from when it starts.

The man page has this to say (I have bolded the file locations):

A login shell begins by executing commands from the system files /etc/csh.cshrc and /etc/csh.login. It then executes commands from files in the user's home directory: first ~/.tcshrc (+) or, if ~/.tcshrc is not found, ~/.cshrc, then ~/.history (or the value of the histfile shell variable), then ~/.login, and finally ~/.cshdirs (or the value of the dirsfile shell variable) (+). The shell may read /etc/csh.login before instead of after /etc/csh.cshrc, and ~/.login before instead of after ~/.tcshrc or ~/.cshrc and ~/.history, if so compiled; see the version shell variable. (+)

If that doesn't lead you anywhere, I would try the following two things:

  • Log in as the offending user and let it hang, switch to a different console and check w - that should show you what that user is running.
  • Ctrl+Z instead of Ctrl+C - that should suspend the running process instead of interrupting it. Then jobs to see what was suspended.

EDIT: As JdeBP pointed out in the comments, you could also set the -x and the -V options to tcsh in su - although I think you could find the offending thing with -X. Something like this:

su - troublesome_user -- -X
  • -x echoes all commands before execution
  • -v command input is echoed after history substitution
  • -X same as -x but applies even before .tcshrc is processed
  • -V same as -v but applies even before .tcshrc is processed
  • 1
    You forgot the obvious: Instruct su to invoke the TENEX C shell with the -x and -V options.
    – JdeBP
    Jul 7 '17 at 7:39

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.