{"id":473101,"date":"2022-07-11T22:00:41","date_gmt":"2022-07-11T19:00:41","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-run-commands-as-another-user-in-linux-scripts\/"},"modified":"2022-07-11T22:00:41","modified_gmt":"2022-07-11T19:00:41","slug":"how-to-run-commands-as-another-user-in-linux-scripts","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-run-commands-as-another-user-in-linux-scripts\/","title":{"rendered":"#How to Run Commands as Another User in Linux Scripts"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a301ff068c74\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a301ff068c74\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-commands-as-another-user-in-linux-scripts\/#%E2%80%9CHow_to_Run_Commands_as_Another_User_in_Linux_Scripts%E2%80%9D\" >&#8220;How to Run Commands as Another User in Linux Scripts&#8221;<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-commands-as-another-user-in-linux-scripts\/#Processes_Have_Owners\" >Processes Have Owners<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-commands-as-another-user-in-linux-scripts\/#Run_a_Script_as_Another_user\" >Run a Script as Another user<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-commands-as-another-user-in-linux-scripts\/#The_runuser_Command\" >The runuser Command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-commands-as-another-user-in-linux-scripts\/#Which_One_to_Use\" >Which One to Use?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"%E2%80%9CHow_to_Run_Commands_as_Another_User_in_Linux_Scripts%E2%80%9D\"><\/span>&#8220;How to Run Commands as Another User in Linux Scripts&#8221;<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<div>\n<figure style=\"width: 1200px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"type:primaryImage  wp-image-770699 size-full\" data-pagespeed-no-defer=\"\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/11\/shutterstock_1278851809.png?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Linux terminal on a laptop over blue background.\" width=\"1200\" height=\"675\" data-crediturl=\"https:\/\/www.shutterstock.com\/image-vector\/command-line-interface-cli-programming-language-1278851809\" data-credittext=\"fatmawati achmad zaenuri\/Shutterstock.com\"\/><figcaption class=\"wp-caption-text\"><span class=\"type:primaryImage imagecredit\"><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.shutterstock.com\/image-vector\/command-line-interface-cli-programming-language-1278851809\">fatmawati achmad zaenuri\/Shutterstock.com<\/a><\/span><\/figcaption><\/figure>\n<p>Naturally enough, when you run a command or <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">script<\/a> the system executes it as a process that was launched by you. But you can run commands and scripts as another user.<\/p>\n<h2 id=\"processes-have-owners\"><span class=\"ez-toc-section\" id=\"Processes_Have_Owners\"><\/span>Processes Have Owners<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>When a program or script is executed, Linux creates a process. That process has an owner. The owner is either another process or the name of a user account if a person launched it.<\/p>\n<p>The ownership of a process defines some of the capabilities and the environment of the process. Depending on how the process was launched, it inherits certain attributes of its parent process or the user. Or, more strictly, the process that the user used to launch the program which is usually a shell.<\/p>\n<p>Running a command or script as another user can be useful because the ownership of any files that are created by the process will belong to the appropriate user.<\/p>\n<p>Every time we use <code>sudo<\/code> we\u2019re running a command as another user. The default user account used by <code>sudo<\/code> is the root or \u2018super\u2019 user. Because of that, <code>sudo<\/code> is often mistakenly thought to stand for\u00a0<em>super user do<\/em>. But that\u2019s just slack jargon. It actually stands for\u00a0<em>substitute user do<\/em>.<\/p>\n<p>With <code>sudo<\/code> , you can run commands as any other user, not just as root. Ironically, you need root privileges to do so. But launching a program or script owned by another user isn\u2019t the same as running that process\u00a0<em>as<\/em>\u00a0that other user. You\u2019ll still be running it as root.<\/p>\n<p>Here\u2019s how to actually run a process as another user, and how to run commands from within a script as though they had been executed by another user.<\/p>\n<h2 id=\"run-a-script-as-another-user\"><span class=\"ez-toc-section\" id=\"Run_a_Script_as_Another_user\"><\/span>Run a Script as Another user<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>We\u2019re using a computer that has multiple users configured. One is Mary, who has the username maryq, and the other is Dave with the user name dave.<\/p>\n<p>Mary has a script called \u201cother-user.sh\u201d in her home directory. This is the text of the script.<\/p>\n<pre>#!\/bin\/bash&#13;\n&#13;\necho \"Script name:\" $0&#13;\necho \"Working directory:\" $(pwd)&#13;\necho \"Script running as user:\" $(whoami)<\/pre>\n<p>It prints out the script name, which is held in the <code>$0<\/code> environment variable. It then uses <code>pwd<\/code> to print the working directory. Finally, it uses the <code>whoami<\/code> command to print the name of the user who launched the script. Or who it <em>thinks<\/em> launched the script.<\/p>\n<p>Copy the text from the script into an editor and save it as \u201cother-user.sh\u201d in the home directory of a different user account.<\/p>\n<p>We\u2019ll need to make the script executable. We\u2019ll use the <code>chmod<\/code> command and use the <code>+x<\/code> (execute) option and the <code>-u<\/code> (user) option to set the execution flag for the owner only. That means only Mary can run the script. We\u2019ll check the file permissions with <code>ls<\/code> .<\/p>\n<pre>chmod u+x other-user.sh<\/pre>\n<pre>ls<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-811265\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/06\/1-5.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Setting the execution permission for the script so that only user Mary can run it\" width=\"644\" height=\"110\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>From left-to-right, the permissions read:<\/p>\n<ul>\n<li>The owner can read, write, and execute the file.<\/li>\n<li>Group members can read and write the file.<\/li>\n<li>Others can only read the file.<\/li>\n<\/ul>\n<p>So the only users capable of running the script are Mary and root. This is what happens when Mary runs the script:<\/p>\n<pre>.\/other-user.sh<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-811269\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/06\/2-4.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"The output when Mary runs the script\" width=\"644\" height=\"130\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>We are told the current working directory of the script is Mary\u2019s home directory, and the owner of the script is the user account maryq.<\/p>\n<p>As expected, Dave can\u2019t run the script.<\/p>\n<pre>\/home\/maryq\/other-user.sh<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-811271\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/06\/3-5.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"User Dave cannot run the script, permission is denied\" width=\"644\" height=\"95\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>If Dave has root user privileges, he can try to run the script as root, using <code>sudo<\/code> .<\/p>\n<pre>sudo \/home\/maryq\/other-user.sh<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-811272\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/06\/4-3.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"The output when the script is run by root\" width=\"644\" height=\"130\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>This is a partial success. The script runs, but the owner of the script is root, not maryq.<\/p>\n<p>The trick we need to employ is the <code>sudo -u<\/code> (user) option. This lets you specify the user you want to run the command as. If you don\u2019t use the <code>-u<\/code> option, <code>sudo<\/code> defaults to using root. If we want to run the command as Mary, we need to pass the name of their user account to the <code>sudo<\/code> command.<\/p>\n<p>sudo -u maryq \/home\/maryq\/other-user.sh<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-811273\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/06\/5-4.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Using the -u user option with root to run the script as user Mary\" width=\"644\" height=\"130\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>This time the script reports that the process owner is maryq.<\/p>\n<p>Let\u2019s add a line to the \u201cother-user.sh\u201d script. We\u2019ll <code>echo<\/code> some text and redirect the output into a file called \u201cmary.txt.\u201d<\/p>\n<pre>#!\/bin\/bash&#13;\n&#13;\necho \"Script name:\" $0 &#13;\necho \"Working directory:\" $(pwd) &#13;\necho \"Script running as user:\" $(whoami)&#13;\necho \"This is going into a file in \/home\/maryq\/\" &gt; \/home\/maryq\/mary.txt<\/pre>\n<p>We\u2019re creating the new file in Mary\u2019s home directory. This is perfectly fine because we\u2019re running the script as Mary.<\/p>\n<pre>.\/other-user.sh<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-811274\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/06\/6-4.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Running the script once more so that it creates a text file\" width=\"644\" height=\"130\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>If we check in Mary\u2019s home directory we\u2019ll see the file has been created, and the ownership of the file belongs to the maryq user account.<\/p>\n<pre>ls -hl mary.txt<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-811277\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/06\/7-3.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Checking the ownership of the file created by the script\" width=\"644\" height=\"95\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>This is the same behavior we\u2019d see if Mary had actually launched the script herself.<\/p>\n<p><strong>RELATED:<\/strong> <strong><em>How to Use the chmod Command on Linux<\/em><\/strong><\/p>\n<pre\/>\n<h2 id=\"the-runuser-command\"><span class=\"ez-toc-section\" id=\"The_runuser_Command\"><\/span>The runuser Command<span class=\"ez-toc-section-end\"><\/span><\/h2>\nYou could use the <code>sudo -u<\/code> commands we\u2019ve used so far inside a script, but there\u2019s another command, <code>runuser<\/code>, that\u2019s designed to run processes as a different user from inside scripts. It has better handling of the return code from the launched process, and it has fewer overheads than <code>sudo<\/code>.\n\nThe <code>runuser<\/code> command needs to be run by root, but that is accomplished by running the entire script as root. You don\u2019t need to use <code>sudo<\/code> inside the script. The <code>runuser<\/code> command can be used on the command line, too, so isn\u2019t restricted to script use, although it is the preferred method for scripts.\n\nDave can\u2019t list the \u201cmary.txt\u201d file because it is in Mary\u2019s home directory and he doesn\u2019t have access.\n<pre>cat \/home\/maryq\/mary.txt<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-811282\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/06\/8-3.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"User Dave cannot read Mary's file, permission is denied\" width=\"644\" height=\"95\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>We can peek inside the file using <code>runuser<\/code>, however. The <code>-<\/code> (login) option launches a new shell with an environment very close to the shell environment Mary would have if they had actually logged in. The <code>-c<\/code> (command) option is followed by the command we want to run.<\/p>\n<pre>sudo runuser - maryq -c 'cat mary.txt'<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-811283\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/06\/9-3.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Reading Mary's file using the runuser command\" width=\"644\" height=\"95\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Note that the command doesn\u2019t need the full path to the file. We can reference the file in the same way that Mary would, relative to her home directory.<\/p>\n<p>As user Dave, we\u2019ll create a script called \u201crun-maryq.sh\u201d with this text in it:<\/p>\n<pre>#!\/bin\/bash&#13;\n&#13;\nrunuser -l maryq -c 'cat mary.txt'<\/pre>\n<p>We\u2019ll make it executable:<\/p>\n<pre>chmod +x run-maryq.sh<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-811293\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/06\/13-3.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Making the script executable with chmod\" width=\"644\" height=\"75\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Let\u2019s see what happens when we try to run it.<\/p>\n<pre>.\/run-maryq.sh<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-811284\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/06\/10-3.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Running the script with runuser inside, as a regular user\" width=\"644\" height=\"95\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>The <code>runuser<\/code> command complains because it is being executed by a regular user. Let\u2019s run it again with <code>sudo<\/code>.<\/p>\n<pre>sudo .\/run-maryq.sh<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-811287\" data-pagespeed-lazy-src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/06\/11-3.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Running the script with runuser inside, as root\" width=\"643\" height=\"95\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>That works as we\u2019d like it to, and just as if Mary had launched the script herself.<\/p>\n<h2 id=\"which-one-to-use\"><span class=\"ez-toc-section\" id=\"Which_One_to_Use\"><\/span>Which One to Use?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>On the command line, there\u2019s not a lot to choose between them. But as you\u2019ve got to use <code>sudo<\/code> with <code>runuser<\/code> anyway, you might as well use <code>sudo<\/code> on its own.<\/p>\n<p>But in a script, <code>runuser<\/code> is the preferred command.<\/p>\n<p><strong>RELATED:<\/strong> <strong><em>10 Basic Linux Commands for Beginners<\/em><\/strong><\/p>\n<\/div>\n<p><script>\n setTimeout(function(){\n  !function(f,b,e,v,n,t,s)\n  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n  n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n  if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n  n.queue=[];t=b.createElement(e);t.async=!0;\n  t.src=v;s=b.getElementsByTagName(e)[0];\n  s.parentNode.insertBefore(t,s) } (window, document,'script',\n  'https:\/\/connect.facebook.net\/en_US\/fbevents.js');\n   fbq('init', '335401813750447');\n   fbq('track', 'PageView');\n  },3000);\n<\/script><\/p>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.howtogeek.com\/811255\/how-to-run-commands-as-another-user-in-linux-scripts\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;How to Run Commands as Another User in Linux Scripts&#8221; fatmawati achmad zaenuri\/Shutterstock.com Naturally enough, when you run a command or script the system executes it as a process that was launched by you. But you can run commands and scripts as another user. Processes Have Owners When a program or script is executed, Linux&#8230;<\/p>\n","protected":false},"author":1,"featured_media":473102,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/11\/shutterstock_1278851809.png?height=200p&trim=2,2,2,2","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-473101","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/473101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=473101"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/473101\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/473102"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=473101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=473101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=473101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}