How to ignore user's shell when running script by user
-
21-06-2021 - |
Question
I have to run script by user. That user's shell has changed to /script/script1
in /etc/passwd
file. When I run the script, it is getting SHELL as a /script/script1.
Solution
Ah, now that I see the script and the passwd entry, I think I understand what is going on. sem is trying to execute your command line using your shell. If you printenv before the sem do you see that SHELL=home/bkup:/script/script1?
If so, then just export SHELL=/bin/bash (or /bin/sh, whatever) on the line before running sem
If this doesn't work, please show us the output of printenv.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow