Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh: setenv failed when connecting #151

Closed
LennyPenny opened this issue Feb 9, 2023 · 9 comments
Closed

ssh: setenv failed when connecting #151

LennyPenny opened this issue Feb 9, 2023 · 9 comments
Assignees

Comments

@LennyPenny
Copy link

LennyPenny commented Feb 9, 2023

Version: 0.9.0

~/.ssh.config:

Host myhost
  User lenny
  HostName 10.x.x.x
Wishlist

Something went wrong:

ssh: setenv failed

When I just run ssh myhost it works just fine.

I'm also using gpg-agent if that could be affecting this.

Wishlist.log:

2023/02/09 21:51:05 setting delegate height: 2
2023/02/09 21:51:06 offering public key via ssh agent: ssh-ed25519 xxx
2023/02/09 21:51:06 offering public key via ssh agent: ssh-ed25519 xxx
2023/02/09 21:51:06 ignored env PWD
2023/02/09 21:51:06 ignored env DISPLAY
...
2023/02/09 21:51:06 failed to close: read tcp 10.42.32.1:47058->10.42.33.5:22: use of closed network connection
2023/02/09 21:51:06 got an error: failed to create session: could not set env: [<huge list of env vars] ssh: setenv failed
caarlos0 added a commit that referenced this issue Feb 10, 2023
refs #151

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
@caarlos0
Copy link
Member

Hey @LennyPenny , thanks for reporting this... could you try with main? I improved the error message so we know which env is failing to set... that might help debug it 🙏

@caarlos0 caarlos0 self-assigned this Feb 10, 2023
@LennyPenny
Copy link
Author

2023/02/10 15:48:39 got an error: failed to create session: could not set env: LC_CTYPE=de_DE.UTF-8: ssh: setenv failed
2023/02/10 15:48:39 error: failed to create session: could not set env: LC_CTYPE=de_DE.UTF-8: ssh: setenv failed

maybe this issue is that de_DE.UTF-8 is not installed on the server

@LennyPenny
Copy link
Author

LennyPenny commented Feb 10, 2023

Just checked and it is in fact installed! and it's also correctly set when I manually ssh into the server (but I think I just configured that remote user that way anyway)

@caarlos0
Copy link
Member

@LennyPenny sorry for the delay, missed your response here.

If you send those envs to SSH using plain ssh, does it work? I think its probably warning you about it, and maybe we need to do the same instead of hard-erroring...

Could you try? Thanks!

@caarlos0
Copy link
Member

BTW: I also tried to reproduce your issue, even sending 100% sure uninstalled locales, as well as inexistent ones, couldn't reproduce... I'm guessing you have something different than me on /etc/ssh/sshd_config...

caarlos0 added a commit that referenced this issue Mar 22, 2023
OpenSSH also seems to only warn (judging by several stackoverflow posts,
couldn't reproduce) when setting an environment variable fails.

I believe we can do the same on wishlist.

This refs #151
@LennyPenny
Copy link
Author

LennyPenny commented Mar 22, 2023

aah hmm, like I'm not sure it should even setenv all these vars? Doesn't seem to be very useful to set things like PWD or DESKTOP_SESSION on a server I'm sshing into

@caarlos0
Copy link
Member

It should be setting only lang and lc_* flags unless you specified the others somewhere. 🤔

caarlos0 added a commit that referenced this issue Mar 31, 2023
OpenSSH also seems to only warn (judging by several stackoverflow posts,
couldn't reproduce) when setting an environment variable fails.

I believe we can do the same on wishlist.

This refs #151
@caarlos0
Copy link
Member

caarlos0 commented Apr 3, 2023

since dfc7c3d it won't fail if setenv errors... so this should be fixed...

can you give the main branch a try @LennyPenny ?

@LennyPenny
Copy link
Author

works like a charm now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants