How do I run a script as sudo at boot time on Ubuntu 18.04 Server?How to run a script during boot as rootOne time “firmware” upgrade scriptHow to run a tcl program/scriptRun script on login (script with sudo) or startupProblem when run script in bootHow to run scripts from github on ubuntuRunning a python script from my php serverHow can I make a script executable?Suspend SUDO in Bash Script?Cannot run bash script permission denied

How do credit card companies know what type of business I'm paying for?

Is there a term for someone whose preferred policies are a mix of Left and Right?

How to search for Android apps without ads?

How can I maintain game balance while allowing my player to craft genuinely useful items?

How to make a villain when your PCs are villains?

My husband's visa refused but mine wasn't -- can I travel?

...and then she held the gun

How to know whether to write accidentals as sharps or flats?

XML Query Question

How useful is the GRE Exam?

Interview was just a one hour panel. Got an offer the next day; do I accept or is this a red flag?

How can a flywheel makes engine runs smoothly?

Leveraging cash for buying car

New Site Design!

Does knowing the surface area of all faces uniquely determine a tetrahedron?

How to sort human readable size

How do I become a better writer when I hate reading?

How would Japanese people react to someone refusing to say “itadakimasu” for religious reasons?

Is the infant mortality rate among African-American babies in Youngstown, Ohio greater than that of babies in Iran?

Is swap gate equivalent to just exchanging the wire of the two qubits?

Having some issue with notation in a Hilbert space

Is my research statement supposed to lead to papers in top journals?

Right indicator flash-frequency has increased and rear-right bulb is out

What is the precise meaning of "подсел на мак"?



How do I run a script as sudo at boot time on Ubuntu 18.04 Server?


How to run a script during boot as rootOne time “firmware” upgrade scriptHow to run a tcl program/scriptRun script on login (script with sudo) or startupProblem when run script in bootHow to run scripts from github on ubuntuRunning a python script from my php serverHow can I make a script executable?Suspend SUDO in Bash Script?Cannot run bash script permission denied






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















How do I run a script as sudo at boot time?



I need to run ethtool --offload <net> rx off to disable the annoying jme udp checksum error message.










share|improve this question









New contributor



Amie Nel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • why do you believe you would need sudo at boot time?

    – Rinzwind
    9 hours ago











  • @Rinzwind probably because ethtool needs root to run. SystemD unit as root is the best approach

    – Thomas Ward
    8 hours ago






  • 1





    "as sudo" - you mean "as root (the all-powerful user with $UID=0)". sudo is a tool for allowing a regular user to run a command as root. "at boot" - everything involved with system startup runs as root

    – waltinator
    5 hours ago

















2















How do I run a script as sudo at boot time?



I need to run ethtool --offload <net> rx off to disable the annoying jme udp checksum error message.










share|improve this question









New contributor



Amie Nel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • why do you believe you would need sudo at boot time?

    – Rinzwind
    9 hours ago











  • @Rinzwind probably because ethtool needs root to run. SystemD unit as root is the best approach

    – Thomas Ward
    8 hours ago






  • 1





    "as sudo" - you mean "as root (the all-powerful user with $UID=0)". sudo is a tool for allowing a regular user to run a command as root. "at boot" - everything involved with system startup runs as root

    – waltinator
    5 hours ago













2












2








2








How do I run a script as sudo at boot time?



I need to run ethtool --offload <net> rx off to disable the annoying jme udp checksum error message.










share|improve this question









New contributor



Amie Nel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











How do I run a script as sudo at boot time?



I need to run ethtool --offload <net> rx off to disable the annoying jme udp checksum error message.







18.04 scripts






share|improve this question









New contributor



Amie Nel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



Amie Nel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited 9 hours ago









SurvivalMachine

1,67931021




1,67931021






New contributor



Amie Nel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 9 hours ago









Amie NelAmie Nel

111




111




New contributor



Amie Nel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




Amie Nel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • why do you believe you would need sudo at boot time?

    – Rinzwind
    9 hours ago











  • @Rinzwind probably because ethtool needs root to run. SystemD unit as root is the best approach

    – Thomas Ward
    8 hours ago






  • 1





    "as sudo" - you mean "as root (the all-powerful user with $UID=0)". sudo is a tool for allowing a regular user to run a command as root. "at boot" - everything involved with system startup runs as root

    – waltinator
    5 hours ago

















  • why do you believe you would need sudo at boot time?

    – Rinzwind
    9 hours ago











  • @Rinzwind probably because ethtool needs root to run. SystemD unit as root is the best approach

    – Thomas Ward
    8 hours ago






  • 1





    "as sudo" - you mean "as root (the all-powerful user with $UID=0)". sudo is a tool for allowing a regular user to run a command as root. "at boot" - everything involved with system startup runs as root

    – waltinator
    5 hours ago
















why do you believe you would need sudo at boot time?

– Rinzwind
9 hours ago





why do you believe you would need sudo at boot time?

– Rinzwind
9 hours ago













@Rinzwind probably because ethtool needs root to run. SystemD unit as root is the best approach

– Thomas Ward
8 hours ago





@Rinzwind probably because ethtool needs root to run. SystemD unit as root is the best approach

– Thomas Ward
8 hours ago




1




1





"as sudo" - you mean "as root (the all-powerful user with $UID=0)". sudo is a tool for allowing a regular user to run a command as root. "at boot" - everything involved with system startup runs as root

– waltinator
5 hours ago





"as sudo" - you mean "as root (the all-powerful user with $UID=0)". sudo is a tool for allowing a regular user to run a command as root. "at boot" - everything involved with system startup runs as root

– waltinator
5 hours ago










2 Answers
2






active

oldest

votes


















6














You can create a systemd service.



Create a file /etc/systemd/system/ethtool.service:



[Unit]
Description=ethtool script

[Service]
ExecStart=/path/to/yourscript.sh

[Install]
WantedBy=multi-user.target


And script /path/to/yourscript.sh (don't forget to chmod +x it)



#!/bin/bash
ethtool --offload <net> rx off


Enable your service



systemctl enable ethtool


It will run on boot as root.






share|improve this answer








New contributor



deimos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Thanks, this worked for me

    – Amie Nel
    8 hours ago











  • If @deimos excellent answer was helpful, please accept it: askubuntu.com/tour The searchers will appreciate knowing that the answer works as expected.

    – chili555
    3 hours ago


















1














Put your commands in /etc/rc.local
or create that file if it does not exist:



 touch /etc/rc.local
chmod +x /etc/rc.local


All these actions have to be done as root.






share|improve this answer








New contributor



Willem Vermin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Amie Nel is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1151080%2fhow-do-i-run-a-script-as-sudo-at-boot-time-on-ubuntu-18-04-server%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    6














    You can create a systemd service.



    Create a file /etc/systemd/system/ethtool.service:



    [Unit]
    Description=ethtool script

    [Service]
    ExecStart=/path/to/yourscript.sh

    [Install]
    WantedBy=multi-user.target


    And script /path/to/yourscript.sh (don't forget to chmod +x it)



    #!/bin/bash
    ethtool --offload <net> rx off


    Enable your service



    systemctl enable ethtool


    It will run on boot as root.






    share|improve this answer








    New contributor



    deimos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.



















    • Thanks, this worked for me

      – Amie Nel
      8 hours ago











    • If @deimos excellent answer was helpful, please accept it: askubuntu.com/tour The searchers will appreciate knowing that the answer works as expected.

      – chili555
      3 hours ago















    6














    You can create a systemd service.



    Create a file /etc/systemd/system/ethtool.service:



    [Unit]
    Description=ethtool script

    [Service]
    ExecStart=/path/to/yourscript.sh

    [Install]
    WantedBy=multi-user.target


    And script /path/to/yourscript.sh (don't forget to chmod +x it)



    #!/bin/bash
    ethtool --offload <net> rx off


    Enable your service



    systemctl enable ethtool


    It will run on boot as root.






    share|improve this answer








    New contributor



    deimos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.



















    • Thanks, this worked for me

      – Amie Nel
      8 hours ago











    • If @deimos excellent answer was helpful, please accept it: askubuntu.com/tour The searchers will appreciate knowing that the answer works as expected.

      – chili555
      3 hours ago













    6












    6








    6







    You can create a systemd service.



    Create a file /etc/systemd/system/ethtool.service:



    [Unit]
    Description=ethtool script

    [Service]
    ExecStart=/path/to/yourscript.sh

    [Install]
    WantedBy=multi-user.target


    And script /path/to/yourscript.sh (don't forget to chmod +x it)



    #!/bin/bash
    ethtool --offload <net> rx off


    Enable your service



    systemctl enable ethtool


    It will run on boot as root.






    share|improve this answer








    New contributor



    deimos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.









    You can create a systemd service.



    Create a file /etc/systemd/system/ethtool.service:



    [Unit]
    Description=ethtool script

    [Service]
    ExecStart=/path/to/yourscript.sh

    [Install]
    WantedBy=multi-user.target


    And script /path/to/yourscript.sh (don't forget to chmod +x it)



    #!/bin/bash
    ethtool --offload <net> rx off


    Enable your service



    systemctl enable ethtool


    It will run on boot as root.







    share|improve this answer








    New contributor



    deimos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.








    share|improve this answer



    share|improve this answer






    New contributor



    deimos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.








    answered 8 hours ago









    deimosdeimos

    24116




    24116




    New contributor



    deimos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.




    New contributor




    deimos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.














    • Thanks, this worked for me

      – Amie Nel
      8 hours ago











    • If @deimos excellent answer was helpful, please accept it: askubuntu.com/tour The searchers will appreciate knowing that the answer works as expected.

      – chili555
      3 hours ago

















    • Thanks, this worked for me

      – Amie Nel
      8 hours ago











    • If @deimos excellent answer was helpful, please accept it: askubuntu.com/tour The searchers will appreciate knowing that the answer works as expected.

      – chili555
      3 hours ago
















    Thanks, this worked for me

    – Amie Nel
    8 hours ago





    Thanks, this worked for me

    – Amie Nel
    8 hours ago













    If @deimos excellent answer was helpful, please accept it: askubuntu.com/tour The searchers will appreciate knowing that the answer works as expected.

    – chili555
    3 hours ago





    If @deimos excellent answer was helpful, please accept it: askubuntu.com/tour The searchers will appreciate knowing that the answer works as expected.

    – chili555
    3 hours ago













    1














    Put your commands in /etc/rc.local
    or create that file if it does not exist:



     touch /etc/rc.local
    chmod +x /etc/rc.local


    All these actions have to be done as root.






    share|improve this answer








    New contributor



    Willem Vermin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      1














      Put your commands in /etc/rc.local
      or create that file if it does not exist:



       touch /etc/rc.local
      chmod +x /etc/rc.local


      All these actions have to be done as root.






      share|improve this answer








      New contributor



      Willem Vermin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





















        1












        1








        1







        Put your commands in /etc/rc.local
        or create that file if it does not exist:



         touch /etc/rc.local
        chmod +x /etc/rc.local


        All these actions have to be done as root.






        share|improve this answer








        New contributor



        Willem Vermin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        Put your commands in /etc/rc.local
        or create that file if it does not exist:



         touch /etc/rc.local
        chmod +x /etc/rc.local


        All these actions have to be done as root.







        share|improve this answer








        New contributor



        Willem Vermin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.








        share|improve this answer



        share|improve this answer






        New contributor



        Willem Vermin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.








        answered 9 hours ago









        Willem VerminWillem Vermin

        111




        111




        New contributor



        Willem Vermin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.




        New contributor




        Willem Vermin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






















            Amie Nel is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            Amie Nel is a new contributor. Be nice, and check out our Code of Conduct.












            Amie Nel is a new contributor. Be nice, and check out our Code of Conduct.











            Amie Nel is a new contributor. Be nice, and check out our Code of Conduct.














            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1151080%2fhow-do-i-run-a-script-as-sudo-at-boot-time-on-ubuntu-18-04-server%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

            Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

            François Viète Contents Biography Work and thought Bibliography See also Notes Further reading External links Navigation menup. 21Google Bookspp. 75–77Google BooksDe thou (from University of Saint Andrews)ArchivedGoogle BooksGoogle BooksGoogle BooksGoogle booksGoogle Bookscc-parthenay.frL'histoire universelle (fr)Universal History (en)ArchivedAdsabs.harvard.eduPagesperso-orange.frArchive.orgChikara Sasaki. Descartes' mathematical thought p.259Google BooksGoogle BooksGoogle Bookspp. 152 and onwardGoogle BooksGoogle BooksScribd.comGoogle Books1257-7979Google BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGallica.bnf.frGoogle BooksGoogle Books"François Viète"Francois Viète: Father of Modern Algebraic NotationThe Lawyer and the GamblerAbout TarporleySite de Jean-Paul GuichardL'algèbre nouvelle"About the Harmonicon"cb120511976(data)1188044800000 0001 0913 5903n82164680ola2013766880073431702w6vt1sb70287374827140948071409480