-
Have an experienced user look at your shell's
setup files (
2.2
)
.
There could be some obvious mistakes that you didn't catch.
-
Log in to another account and use the
su stucklogin
(
22.22
)
command (if
the stuck account uses Bourne-type shells) or the
su -f stucklogin
command (if the stuck account uses
csh
or
tcsh
).
Change (
cd
) to the home directory.
Rename the account's setup files
so the shell won't see them as you
log in.
If you can log in after that, you know that the problem is with the
account's setup files.
-
Set shell debugging (
8.17
)
.
From another account or as the superuser, start an editor and put
the following line at the top of an
sh
-like setup file (like
.profile
).
It'll tell you whether
the
.profile
is being read at all and where it hangs:
set -xv
You'll see each line read from the
.profile
and the commands executed
on the screen. If you don't see anything, then the shell probably didn't
read the
.profile
.
C shell users should put this command at the top of
.cshrc
instead:
set echo verbose
Note that on many UNIX systems, the shell won't read its startup files
if the files aren't owned by you.
You might use
ls -l
(
22.2
)
to check.
-
Look at the entry in the
/etc/passwd
file (
36.3
)
for this user.
Be sure it has the correct number of fields (separated by
:
).
Also, see if there's another user with the same login name.
(If your system has the commands
vipw
(8) and
pwck
(8),
your system administrator should be using them to edit and check the
passwd
file.
They avoid many of these problems.)
-
Does your account use any
directories remotely mounted (by NFS) (
1.33
)
?
If the remote host or network is down, and any command in your startup
files (especially
set path
) tries to access those
directories, the shell may hang there.
To fix that problem,
su
to the account as explained above and take the
command or directory name out of your startup file.
Or, if this problem happens a lot, the system administrator can mount an
NFS filesystem "soft" (instead of the default, "hard") and limit the number
of retrys.
-
What looks like a "hang" might also be that you just aren't getting any output
to the terminal, for some very weird reason.
Then the
set -xv
wouldn't help you.
In that case, try adding this line to the start of the
.profile
:
exec > /tmp/sh.out.$$ 2>&1
If the Bourne shell starts reading the
.profile
, it'll make a file in
/tmp
(
21.3
)
called
sh.out.
nnn
with output from the commands and the
shell's
set -xv
.
There's no command like that for the C shell.