Re: interactive and login shells: bug or design decision ?

From: Greg Wooledge (wooledg_at_eeg.ccf.org)
Date: 03/24/05

  • Next message: Cristian Zoicas: "ERRATA : interactive and login shells: bug or design decision ?"
    Date: Thu, 24 Mar 2005 07:54:46 -0500
    To: Cristian Zoicas <zoicas@ictp.trieste.it>
    
    

    On Wed, Mar 23, 2005 at 05:07:58PM +0100, Cristian Zoicas wrote:
    > When ssh is started interactively, it starts a login shell, but when it is
    > started in batch mode (e.g. ssh user@some.site.com command) it runs my
    > command under an interactive shell.

    It doesn't do that for me. From man bash:

           An interactive shell is one started without non-option arguments and
           without the -c option whose standard input and output are both con-
           nected to terminals (as determined by isatty(3)), or one started with
           the -i option. PS1 is set and $- includes i if bash is interactive,
           allowing a shell script or a startup file to test this state.

    And on my system:

    imadev:~$ ssh localhost 'echo $-'
    wooledg@localhost's password:
    hBc

    imadev:~$ ssh localhost 'echo $PS1'
    wooledg@localhost's password:

    (That's a blank line after the password prompt.)

    > The ssh version that I use is OpenSSH_3.6.1p2

    OpenSSH 3.9p1 for me, on HP-UX 10.20, with bash 2.05b.


  • Next message: Cristian Zoicas: "ERRATA : interactive and login shells: bug or design decision ?"

    Relevant Pages

    • Re: bash on login.
      ... connect by ssh on my server the bash don't parse .bashrc file. ... When an interactive shell that is not a login shell is started, ... Ssh is a login shell. ...
      (freebsd-questions)
    • Re: Working with sshs escape character
      ... Try hitting tilde followed by period and see what happens within an ssh ... from within a login shell over ssh. ... The escape character must always follow a newline to be interpreted as ...
      (Debian-User)
    • SUMMARY: how to set correct path?
      ... ven if we login with ssh. ... For BASH login shell, place the system wide ENV variables, such as PATH, ... You can set Use_login in the sshd_config to yes and restart sshd. ...
      (SunManagers)
    • Re: Ssh and sftp via here document
      ... The file transfer is performed by sftp during an ssh session ... storing cleartext passwords in the script. ... Note that echo 3 and echo 4 do not appear; ... Everything works as I expect when I issue the ssh and sftp commands ...
      (comp.unix.shell)
    • ssh and change group id
      ... I am trying to ssh to a remote host but execute as a different group id on ... echo `id` ... If I issue the sg command locally, ...
      (SSH)