Sudo-g5k: Difference between revisions
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Portal|User}} | |||
{{Portal|Tutorial}} | |||
{{TutorialHeader}} | |||
== About sudo-g5k == | == About sudo-g5k == | ||
<code class="command">sudo-g5k</code> is a command available in the Grid'5000 '''standard environment''' (the operating system running on nodes when not deploying), which allows to '''gain | <code class="command">sudo-g5k</code> is a command available in the Grid'5000 '''standard environment''' (the operating system running on nodes when not deploying), which allows to '''gain root privilege''', just like with the standard <code class="command">sudo</code> command. | ||
This allows you to modify the operating system, for instance installing additional Debian packages, or change the system configuration. | |||
== Using sudo-g5k == | |||
== | === Direct usage === | ||
== | The simplest way is to prefix your command with <code class="command">sudo-g5k</code>, for example: | ||
<code class="command">sudo-g5k</code> can | |||
<code class="host">janedoe@parapluie-31:~$ </code><code class="command">sudo-g5k apt-get install cowsay</code> | |||
You can also use it to become root: | |||
<code class="host">janedoe@parapluie-31:~$ </code><code class="command">sudo-g5k</code> -i | |||
<code class="host">root@parapluie-31:~# </code> | |||
Overall, it works exactly like the regular <code class="command">sudo</code> command. | |||
=== Indirect usage === | |||
You can also run <code class="command">sudo-g5k</code> without argument. In that case, it will simply allow the use of the <code class="command">sudo</code> for the rest of the lifetime of the job. | |||
<code class="host">janedoe@parapluie-31:~$ </code><code class="command">sudo-g5k</code> | |||
<code class="host">janedoe@parapluie-31:~$ </code><code class="command">sudo apt-get install cowsay</code> # Notice the use of regular sudo | |||
This is very useful if you need to run a script that uses <code class="command">sudo</code> internally: | |||
<code class="host">janedoe@parapluie-31:~$ </code><code class="command">sudo-g5k</code> | |||
<code class="host">janedoe@parapluie-31:~$ </code><code class="command">./install-software.sh</code> # Script that is using sudo internally | |||
== Limitations and alternatives == | |||
While this is a very quick way to become root on a node, note that [[Getting_Started#Deploying_your_nodes_to_get_root_access_and_create_your_own_experimental_environment|deploying your nodes]] gives you root access straight away and provides more features: you can deploy different operating systems such as Ubuntu or CentOS, and you can even deploy your own customized operating system image for your experiment (with the software stack of your experimentation already deployed). See the [[Environment creation]] page for more details. | |||
Also note that <code class="command">sudo-g5k</code> does not grant the root privileges on all the nodes of a job, but only on the node you are currently logged in. In a job with many nodes, <code class="command">sudo-g5k</code> has to be called on every node where you want to become root. | |||
== How it works == | |||
<code class="command">sudo-g5k</code> is a wrapper script on top of <code class="command">sudo</code>, which adds some verification with regard to the rights obtained within a job (first of all, to use <code class="command">sudo-g5k</code>, the job must have reserved the whole node, not just some of the CPUs, cores or GPUs). | |||
The wrapper also notifies that the system of the node is modified, so that the node must be redeployed after the job. As such, using <code class="command">sudo-g5k</code> has quite a huge impact on the platform. For instance, if you end an interactive job on a node after using sudo-g5k, that node won't be available before some time, due to the redeployment process triggered by Grid'5000. |
Latest revision as of 06:32, 27 June 2023
Note | |
---|---|
This page is actively maintained by the Grid'5000 team. If you encounter problems, please report them (see the Support page). Additionally, as it is a wiki page, you are free to make minor corrections yourself if needed. If you would like to suggest a more fundamental change, please contact the Grid'5000 team. |
About sudo-g5k
sudo-g5k
is a command available in the Grid'5000 standard environment (the operating system running on nodes when not deploying), which allows to gain root privilege, just like with the standard sudo
command.
This allows you to modify the operating system, for instance installing additional Debian packages, or change the system configuration.
Using sudo-g5k
Direct usage
The simplest way is to prefix your command with sudo-g5k
, for example:
janedoe@parapluie-31:~$
sudo-g5k apt-get install cowsay
You can also use it to become root:
janedoe@parapluie-31:~$
sudo-g5k
-iroot@parapluie-31:~#
Overall, it works exactly like the regular sudo
command.
Indirect usage
You can also run sudo-g5k
without argument. In that case, it will simply allow the use of the sudo
for the rest of the lifetime of the job.
janedoe@parapluie-31:~$
sudo-g5k
janedoe@parapluie-31:~$
sudo apt-get install cowsay
# Notice the use of regular sudo
This is very useful if you need to run a script that uses sudo
internally:
janedoe@parapluie-31:~$
sudo-g5k
janedoe@parapluie-31:~$
./install-software.sh
# Script that is using sudo internally
Limitations and alternatives
While this is a very quick way to become root on a node, note that deploying your nodes gives you root access straight away and provides more features: you can deploy different operating systems such as Ubuntu or CentOS, and you can even deploy your own customized operating system image for your experiment (with the software stack of your experimentation already deployed). See the Environment creation page for more details.
Also note that sudo-g5k
does not grant the root privileges on all the nodes of a job, but only on the node you are currently logged in. In a job with many nodes, sudo-g5k
has to be called on every node where you want to become root.
How it works
sudo-g5k
is a wrapper script on top of sudo
, which adds some verification with regard to the rights obtained within a job (first of all, to use sudo-g5k
, the job must have reserved the whole node, not just some of the CPUs, cores or GPUs).
The wrapper also notifies that the system of the node is modified, so that the node must be redeployed after the job. As such, using sudo-g5k
has quite a huge impact on the platform. For instance, if you end an interactive job on a node after using sudo-g5k, that node won't be available before some time, due to the redeployment process triggered by Grid'5000.