Passwords in Linux scripts?
Posted: Tue Jun 05, 2018 8:07 pm
I would need to run "sudo su" in a script (.sh), but how can I include the password it needs? (No need to worry about security, the script will not launch nuclear weapons... ; )
Support Forum
https://forum.hyperion-entertainment.com/
https://forum.hyperion-entertainment.com/viewtopic.php?t=4041
Code: Select all
username ALL=(ALL) NOPASSWD: ALLThanks for the tip! Unfortunately, it works only partially... If I open a Term window, I can now use 'sudo su' without password. But the script where I have 'sudo su' on the first line still doesn't work, except from 'root'. Is there a way to get some output from a script, error messages etc.?xeno74 wrote:What do you think about this?
sudo visudo
Where username is the user who executes the script.Code: Select all
username ALL=(ALL) NOPASSWD: ALL
When I first tested the individual commands for the script in a terminal, one of them needed that I use "sudo su". Plain "sudo" was not able to run it. So I thought I have to have 'sudo su' as the first command in the script!xeno74 wrote:Why sudo su? You can execute your script with sudo.