[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Why does my ssh session terminate immediately?

Guido Martínez wrote:
> > thanks for that.  Here is what I get:
> > ,----
> > | + '[' -z '' ']'
> > | + return
> > | Connection to closed.
> > `----
> > I guess that means, that "PS1" is unset in this case?

If that is the test at that point.  But return in a .bashrc for an
interactive shell will just go to the command prompt.

> Looks like it, but I think that it shouldn't terminate bash anyway.
> The 'return' you see is local to .bashrc or whatever file was being
> loaded.

Agreed.  That by itself isn't enough for me to know where it is.

> Try running 'ssh root@ bash --norc --noprofile -i' and

Excellent suggestion!  I had not thought of the --norc --noprofile
options.  But you will still need 'ssh -t' to have ssh allocate a
pty/tty to the session.  Otherwise bash won't be able to support raw
mode and libreadline will be turned off.

  ssh -t root@ bash --norc --noprofile -i

> see if you get a shell. If you do, it would suggest some
> misconfiguration of bash but from what I can see your configs are OK..
> (For some reason, the '-i' arg can't be before the long args, or
> you'll get a bash invocation error)

Bash has a custom program specific command line parser.  It is
specifically looking for long options first.  It does this for
legacy compatibility reasons.

An additional hint:  If you are logged out immediately you can still
use sftp to transfer files.  That would be enough to copy off .bashrc
files and delete them for example.  Since you had copies of your files
I assumed you had some means of getting to them.


Attachment: signature.asc
Description: Digital signature

Reply to: