Sudo-g5k

From Grid5000
Jump to navigation Jump to search
Note.png 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 -i
 root@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.