The login is the core concept in jargon--login shell.
There are four stages abstracted to describe linux work:Init, Getty, Login , Shell.
Here login is a program, which gets the username as a parameter, and prompts the user for the password.
On local side:
vim /tmp/shell.sh shopt login_shell On server side(my vps server):
vim /tmp/shell.sh shopt login_shell 1.non-interactive login shell
general format: ssh example.com <my-script-which-is-stored-locally
ssh root@vps_ip < /tmp/shell.sh Pseudo-terminal will not be allocated because stdin is not a terminal. login_shell on More clearly
ssh -t -t root@vps_ip < /tmp/shell.sh Last login: Wed Mar 8 03:16:00 2017 from vps_ip root@localhost:~$ root@localhost:~$ shopt login_shell login_shell on The interpreter on local side break ssh -t -t root@vps_ip < /tmp/shell.sh into two parts.
1.ssh -t -t root@vps_ip
login program accept root as user on the vps,logined.
2./tmp/shell.sh
the script on the local side passed as a parameter into interpreter on remote side ,and executed.
It is non-interactive login shell during the process.
2.non-interactive non-login shell
general format:ssh example.com my-script-which-is-stored-on-remote-machine
debian8@hwy:~$ssh root@vps_ip '/bin/bash /tmp/shell.sh' login_shell off debian8@hwy:~$ It is non-interactive non-login shell during the process.
Some hack trick can make it display as login shell.
debian8@hwy:~$ssh root@vps_ip '/bin/bash --login /tmp/shell.sh' login_shell on debian8@hwy:~$ The vps server does not be logined after the whole command ssh root@vps_ip '/bin/bash --login /tmp/shell.sh' performed.
The login_shell on displayed no meaning,it logined but vps server closed connection ,logined out.
Gilles's conclusion conclusions on non-interactive login shell and non-interactive non-login shell is right.