On Slurm computation node I have:

```bash
ssh-add -L
```
```
Error connecting to agent: No such file or directory
```

While on Slurm master node I have:

```bash
ssh-add -L
```
```
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF8aFTPQTl29ivER51v5ccVOYASp5Ay20J1xVpBcn6G7 udlc74081@dalia.idris.fr
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKFA3TrsyF/0UPIrW9WmoHiAs8wivxgKY0+d8sc2p3D7Qvl43qNmc6BQPBWXYB6UMppIgR7goYPExuqndA8On7Y= udlc74081@dalianvl10
```

How to `ForwardAgent` as in `~/.ssh/config`?
Apr 2, 1:30pm

To enable SSH agent forwarding when connecting to Slurm computation nodes, you need to ensure two things:

  1. Your local SSH agent is running and has the relevant keys loaded.
  2. The SSH connection to the Slurm master node forwards the agent.

1. Ensure ssh-agent is running and keys are loaded

On your local machine (not the Slurm nodes), make sure your SSH agent is running and your keys are loaded:

bash
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_ed25519  # Replace with your key path if different

2. Configure SSH agent forwarding in ~/.ssh/config

On your local machine, edit or create ~/.ssh/config and add:

plaintext
Host dalia.idris.fr
  ForwardAgent yes

If you connect to the Slurm master node via a bastion/jump host, you need to ensure the forwarding is set up for the entire chain:

plaintext
Host dalia.idris.fr
  ForwardAgent yes

Host *.idris.fr
  ForwardAgent yes

3. Connect to the Slurm master node with agent forwarding

When you SSH into the Slurm master node, use:

bash
ssh -A dalia.idris.fr

4. For Slurm jobs

When submitting a job or connecting to a computation node via srun or sbatch, ensure you use the -A flag:

bash
srun -A --jobid=<jobid> ssh <computation-node-ip>

Or, if you use sbatch:

bash
#SBATCH --get-user-env=1

This ensures the agent is forwarded to the computation node.


Summary:

  • Your ssh-add -L works on the master node because the agent is forwarded.
  • On computation nodes, the agent is not forwarded by default unless you use -A or configure Slurm to forward it.
Apr 2, 1:30pm

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.