how to run sudo <commaand>in bash script?
@AcerJust do it, there is nothing special. But usually it's best if you execute the script with sudo instead, because otherwise your user would have to blindly trust you, or inspect the code.
@aluaces
I tried to execute this with sudo, but it seems that the user/group changedbecause I need to re-login into some services when I run sudo ./<script>
@AcerI don't fully understand what you want to do, but maybe it's useful to know that you can also specify the user with sudo: sudo -u user script
it works. thanks.
QOTO: Question Others to Teach Ourselves An inclusive, Academic Freedom, instance All cultures welcome. Hate speech and harassment strictly forbidden.
@Acer
I don't fully understand what you want to do, but maybe it's useful to know that you can also specify the user with sudo: sudo -u user script