Is it possible to run a command
- with parameters first of which starts with
-(dash) e.g./usr/bin/echo -n foo - as different user and group, for example
apache:apache - using command
su - when login shell is set to
/sbin/nologin?
I tried:
su -s "/usr/bin/echo" -g apache apache -n foo- fails with
su: invalid option -- 'n'. It looks like first argument may not start with dash.
- fails with
su -c "/usr/bin/echo -n foo" -g apache apache- fails with
nologin: invalid option -- 'c'. It looks like-ccan't be used if login shell is/sbin/nologin
- fails with
suin CentOS 6 doesn't support-g <group>option. This option is supported in CentOS 7 and 8. – czerny Feb 19 '20 at 18:28