Hacker News new | ask | show | jobs
by usrbinbash 934 days ago
> Similarly doing ssh <host> <command> starts a non-interactive login shell.

Interesting, is there a source for this? Genuinely interested, because the manpage leaves this part a bit vague:

    A login shell is one whose first character of argument zero is a -, or
    one started with the --login option.
    (...)
    Bash attempts to determine when it is being run with its standard input
    connected to a network connection, as when  executed  by the historical
    remote shell daemon, usually rshd, or the secure shell daemon sshd.
    If bash determines it is being run non-interactively in this fashion, it
    reads and executes commands  from  ~/.bashrc, if  that file exists
    and is readable.
Sadly, the manpage for sshd also doesn't mention how exactly the users shell is invoked. It does say however:

    After  this,  the client either requests an interactive shell or
    execution of a non-interactive command
...which I took to understand that the shell dows in fact run as an interactive shell.

> IIRC nope: distros such as Debian often have bashrc source bash profile

Well, these are distro dependent things. Since I am not on Debian, I am just refering to the manpage.

1 comments

You can try this out:

  ssh user@host export
  vs
  ssh user@host --> export
  or
  ssh user@host bash --> export

But it's not sshds job to specify how either shell type is requested.