My goal is to successfully link a folder to /opt/ directory- which needs to be run with sudo.
I have tried this:
system(sudo ln -s $$OUT_PWD/xampp /
After a lot of research:
ssh-askpass Sudo Password | sudo -S bash ./script
Worked like a charm, it asks for the password in a separate window/prompt box. I added it under custom build steps. The important thing is to let sudo
know that it will expect a password input via -S
option.
echo "password" | sudo -S bash ./script
Also works with bash scripts, however as you might think it is insecure storing the sudo password inside the script. It is said that read permissions should fix that issue.