lima-vm / lima-vm/lima

env variables not being sent over SSH with SendEnv and AcceptEnv

Open
#1,481 3 comments 0 reactions 0 assignees View on GitHub
area/cli
Dominant language
Go
Stars
21.9k
Forks
957
Avg merge
2d 6h
Merged PRs (30d)
53

Description

### Description

When I set the `COLORTERM` environment variable locally, it does not get sent through to my VM:

```sh
$ echo $COLORTERM
truecolor
$ limactl shell --debug default
DEBU[0000] changeDirCmd="cd /Users/sam || cd /Users/sam"
DEBU[0000] OpenSSH version 8.6.1 detected
DEBU[0000] AES accelerator seems available, prioritizing aes128-gcm@openssh.com and aes256-gcm@openssh.com
DEBU[0000] executing ssh (may take a long)): [/usr/bin/ssh -F /dev/null -o IdentityFile="/Users/sam/.lima/_config/user" -o IdentityFile="/Users/sam/.ssh/id_rsa" -o IdentityFile="/Users/sam/.ssh/id_rsa_gl" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o NoHostAuthenticationForLocalhost=yes -o GSSAPIAuthentication=no -o PreferredAuthentications=publickey -o Compression=no -o BatchMode=yes -o IdentitiesOnly=yes -o Ciphers="^aes128-gcm@openssh.com,aes256-gcm@openssh.com" -o User=sam -o ControlMaster=auto -o ControlPath="/Users/sam/.lima/default/ssh.sock" -o ControlPersist=5m -t -o SendEnv="COLORTERM" -q -p 60022 127.0.0.1 -- cd /Users/sam || cd /Users/sam ; exec "$SHELL" --login]
sam@lima-default:/Users/sam$ echo $COLORTERM

sam@lima-default:/Users/sam$ cat /etc/ssh/sshd_config | grep AcceptEnv
AcceptEnv COLORTERM LANG LC_*
```

This happens despite the fact that `SendEnv COLORTERM` has been specified client-side and `AcceptEnv COLORTERM` has been configured in the `sshd_config`, as you can see above.

This happens with any variable when I edit the `ssh.config` file generated by Lima and SSH using that as the config file:

```sh
sam@lima-default:~$ echo "AcceptEnv SAM_TEST" | sudo tee -a /etc/ssh/sshd_config
AcceptEnv SAM_TEST
sam@lima-default:~$ sudo systemctl restart ssh
sam@lima-default:~$ exit
$ export SAM_TEST=foo
$ cat ~/.lima/default/ssh.config | grep SendEnv
SendEnv SAM_TEST
$ ssh -F ~/.lima/default/ssh.config lima-default
sam@lima-default:~$ echo $SAM_TEST
```

### Version
OS:
```sh
$ sw_vers
ProductName: macOS
ProductVersion: 12.6.3
BuildVersion: 21G419
```

Lima:
```sh
$ limactl --version
limactl version 0.15.0
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.