by shigemk2


su shell option

ログインシェルを指定する 使い方としては su -s /bin/bash user のような感じで、nologinユーザーのログインなどに有効。

なお、-s オプション、GNU限定でMacOS High Sierraのsuだと -s オプションがないし、FreeBSDだと違う挙動なみたい。

       -s SHELL, --shell=SHELL
              Runs the specified shell instead of the default.  The shell to run is selected according to the following rules in order:

                 o      the shell specified with --shell

                 o      The shell specified in the environment variable SHELL if the --preserve-environment option is used.

                 o      the shell listed in the passwd entry of the target user

                 o      /bin/sh

              If the target user has a restricted shell (i.e. not listed in /etc/shells) the --shell option and the SHELL environment variables are ignored unless
              the calling user is root.