Installation¶
Contents
Overview¶
Remote features in Genv are based on running genv
commands on remote hosts over SSH.
This means that Genv should be installed on all local and remote hosts, and that all local hosts should have SSH access to all remote hosts.
Genv uses commands similar to ssh <host>
for remote execution.
Therefore, authentication must not be interactive using passwords so that the ssh
commands Genv uses would work without additional arguments.
You can follow this to set up your SSH so you don’t have to type passwords.
It is recommended to use SSH keys.
The identity file and login user should be configured in the SSH configuration file at ~/.ssh/config
.
Some of Genv remote features like monitoring and enforcement require privileges and use commands similar to ssh <host> sudo
.
Therefore, system administrators that want to use these features need to have passwordless sudo
permissions on all remote machines.
Genv also sends environment variables over SSH by passing -o SendEnv
to the ssh
command.
Those environment variables must be explicitly accepted on all remote hosts by configuring the SSH daemon on the remote hosts.
Local Hosts¶
On local hosts, Genv should be installed so you could run genv remote
commands.
Then, make sure you have SSH access to all remote hosts and that the SSH configuration is set properly. You can verify that using a command similar to this:
ssh <host> nvidia-smi
Note
If you want to use privileged capabilities like monitoring and enforcement you can verify that ssh <host> sudo nvidia-smi
works.
Warning
It is important that you verify the SSH access.
If you can’t access any of the remote hosts using a command similar to the one above, genv remote
commands will not work properly.
Remote Hosts¶
On remote hosts, Genv must be installed system-wide.
You can verify the setup by running a command similar to this from your local machine:
$ ssh <host> sudo genv -h
usage: genv [-h] SUBCOMMAND ...
...
SSH Daemon Configuration¶
Afterward, it is required to edit the configuration of the SSH daemon.
Genv uses SSH for communication, and relies on sending environment variables from local hosts to remote hosts by passing -o SendEnv
to the ssh
command.
Those environment variables must be explicitly accepted on all remote hosts by modifying the SSH daemon configuration file.
First, add GENV_*
to field AcceptEnv
in /etc/ssh/sshd_config
.
You can do this with the following command (you will probably need to use sudo
here):
sed -i "/^AcceptEnv/s/$/ GENV_*/" /etc/ssh/sshd_config
You can verify that it worked using the command:
grep GENV /etc/ssh/sshd_config
Then, restart the SSH daemon using the following command (you will probably need to use sudo
here as well):
systemctl restart ssh
You can then test that everything is set up properly by running the following command from a local host:
GENV_TEST="ilovegpus" ssh -o SendEnv=GENV_TEST <host> env | grep GENV