Linux shell su: failed to execute,permission denied

su - root -s $SHELLPATH

root users will report an error when executing, and permission denied

pops up.

but use

directly
source $SHELLPATH

can be executed

what is the reason for this?

Thank you.

Jun.22,2021

running the script directly requires the file to have execute permission for the current user. The source command is not required, and source only needs read permission.

you can use

chmod +x yourscript.sh

to set execution permissions

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e468bc-44bd0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e468bc-44bd0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?