Difference between revisions of "Sudo: menjalankan command di script"
Jump to navigation
Jump to search
Onnowpurbo (talk | contribs) (Created page with "sumber: https://askubuntu.com/questions/425754/how-do-i-run-a-sudo-command-inside-a-script It is rarely a good idea to have sudo inside scripts. Instead, remove the sudo f...") |
Onnowpurbo (talk | contribs) |
||
Line 1: | Line 1: | ||
sumber: https://askubuntu.com/questions/425754/how-do-i-run-a-sudo-command-inside-a-script | sumber: https://askubuntu.com/questions/425754/how-do-i-run-a-sudo-command-inside-a-script | ||
− | + | Cara yang normal tambahkan sudo sebelum menjalankan script | |
− | |||
− | |||
− | |||
sudo myscript.sh | sudo myscript.sh | ||
− | + | Atau jika hanya salah satu command saja, bisa | |
sudo -u username command | sudo -u username command | ||
− | + | Atau kalau mau memaksa, bisa | |
+ | exec sudo su -c "perintah" | ||
Revision as of 22:07, 16 December 2018
sumber: https://askubuntu.com/questions/425754/how-do-i-run-a-sudo-command-inside-a-script
Cara yang normal tambahkan sudo sebelum menjalankan script
sudo myscript.sh
Atau jika hanya salah satu command saja, bisa
sudo -u username command
Atau kalau mau memaksa, bisa
exec sudo su -c "perintah"