[GH-ISSUE #2912] SetEnv and multiple Ssh tunnel support #1912

Closed
opened 2026-02-27 00:05:18 +03:00 by kerem · 11 comments
Owner

Originally created by @musahi0128 on GitHub (Aug 6, 2023).
Original GitHub issue: https://github.com/electerm/electerm/issues/2912

What feature you'd like to see or proposal(期望什么新功能/特性或者建议)

Hi, greeting from Indonesia.

I have a server that need some environment variable set on connect.
Using plain ssh client on Windows, my command will look like this:
ssh -i .ssh\id_rsa -o "SetEnv SECRET=XXX" root@host.server.net
I can see that under Bookmarks > Ssh > Settings you have ENV:LANG so I guess it should be possible for you to implement this.

Next, I can see that I can only use one Ssh tunnel at a time. If you can support multiple at once that would be cool.

Thank you for your great software, it is beautiful, I love how it looks.

Originally created by @musahi0128 on GitHub (Aug 6, 2023). Original GitHub issue: https://github.com/electerm/electerm/issues/2912 ### What feature you'd like to see or proposal(期望什么新功能/特性或者建议) Hi, greeting from Indonesia. I have a server that need some environment variable set on connect. Using plain ssh client on Windows, my command will look like this: `ssh -i .ssh\id_rsa -o "SetEnv SECRET=XXX" root@host.server.net` I can see that under Bookmarks > Ssh > Settings you have ENV:LANG so I guess it should be possible for you to implement this. Next, I can see that I can only use one Ssh tunnel at a time. If you can support multiple at once that would be cool. Thank you for your great software, it is beautiful, I love how it looks.
kerem 2026-02-27 00:05:18 +03:00
Author
Owner

@zxdong262 commented on GitHub (Aug 7, 2023):

Thank you for the feedback, can you give an example using multiple Ssh tunnel? By describe how it works.

<!-- gh-comment-id:1667105190 --> @zxdong262 commented on GitHub (Aug 7, 2023): Thank you for the feedback, can you give an example using multiple Ssh tunnel? By describe how it works.
Author
Owner

@musahi0128 commented on GitHub (Aug 7, 2023):

Hi, let me rephrase my request. Ssh tunnel = port forwarding. You can refer to PuTTY configuration under Connection > SSH > Tunnels. In this option you can specify multiple port forwarding.
putty_xj9jpQryAP

<!-- gh-comment-id:1668257738 --> @musahi0128 commented on GitHub (Aug 7, 2023): Hi, let me rephrase my request. Ssh tunnel = port forwarding. You can refer to PuTTY configuration under Connection > SSH > Tunnels. In this option you can specify multiple port forwarding. ![putty_xj9jpQryAP](https://github.com/electerm/electerm/assets/9418340/aa474b89-a1de-4100-aaaa-48957acb7d2e)
Author
Owner

@zxdong262 commented on GitHub (Aug 9, 2023):

ssh -i .ssh\id_rsa -o "SetEnv SECRET=XXX" root@host.server.net

set export SECRET=XXX in login script would be same effect?

<!-- gh-comment-id:1670716065 --> @zxdong262 commented on GitHub (Aug 9, 2023): > ssh -i .ssh\id_rsa -o "SetEnv SECRET=XXX" root@host.server.net set `export SECRET=XXX` in login script would be same effect?
Author
Owner

@musahi0128 commented on GitHub (Aug 9, 2023):

Unfortunately it's different.

<!-- gh-comment-id:1670768171 --> @musahi0128 commented on GitHub (Aug 9, 2023): Unfortunately it's different.
Author
Owner

@zxdong262 commented on GitHub (Sep 17, 2023):

Hi @musahi0128 I am trying to add SetEnv support, can you provide a example to use SetEnv?
like ssh -o "SetEnv=DDD=xxx" execapp@23.239.5.15 'echo $DDD'?
Also do I need to set PermitUserEnvironment=yes in sshd_config to enable it?

<!-- gh-comment-id:1722397306 --> @zxdong262 commented on GitHub (Sep 17, 2023): Hi @musahi0128 I am trying to add SetEnv support, can you provide a example to use SetEnv? like `ssh -o "SetEnv=DDD=xxx" execapp@23.239.5.15 'echo $DDD'`? Also do I need to set `PermitUserEnvironment=yes` in `sshd_config` to enable it?
Author
Owner

@zxdong262 commented on GitHub (Sep 17, 2023):

Got it, thank you! Would remove the credentials since I already copied it.

<!-- gh-comment-id:1722426393 --> @zxdong262 commented on GitHub (Sep 17, 2023): Got it, thank you! Would remove the credentials since I already copied it.
Author
Owner

@zxdong262 commented on GitHub (Sep 17, 2023):

I can login with with the credential you provided, how can I confirm the setenv I set works or not?

<!-- gh-comment-id:1722426890 --> @zxdong262 commented on GitHub (Sep 17, 2023): I can login with with the credential you provided, how can I confirm the setenv I set works or not?
Author
Owner

@musahi0128 commented on GitHub (Sep 17, 2023):

I can login with with the credential you provided, how can I confirm the setenv I set works or not?

If you get the same value for Your Server everytime you log in, that's mean you get it right.

<!-- gh-comment-id:1722457487 --> @musahi0128 commented on GitHub (Sep 17, 2023): > I can login with with the credential you provided, how can I confirm the setenv I set works or not? If you get the same value for `Your Server` everytime you log in, that's mean you get it right.
Author
Owner

@zxdong262 commented on GitHub (Sep 17, 2023):

I can login with with the credential you provided, how can I confirm the setenv I set works or not?

If you get the same value for Your Server everytime you log in, that's mean you get it right.

Which value do you mean? The SECRET? by run echo $SECRET? As I checked env do not have a SECRET, not sure if that is expected.

<!-- gh-comment-id:1722459173 --> @zxdong262 commented on GitHub (Sep 17, 2023): > > I can login with with the credential you provided, how can I confirm the setenv I set works or not? > > If you get the same value for `Your Server` everytime you log in, that's mean you get it right. Which value do you mean? The SECRET? by run `echo $SECRET`? As I checked env do not have a SECRET, not sure if that is expected.
Author
Owner

@musahi0128 commented on GitHub (Sep 17, 2023):

Nope, in this specific case it used to select which instance you will be using. That's why please check the Your Server value each time you login. In normal environment it should be possible to echo the value as you suspected.

<!-- gh-comment-id:1722468473 --> @musahi0128 commented on GitHub (Sep 17, 2023): Nope, in this specific case it used to select which instance you will be using. That's why please check the `Your Server` value each time you login. In normal environment it should be possible to echo the value as you suspected.
Author
Owner

@zxdong262 commented on GitHub (Sep 18, 2023):

Nope, in this specific case it used to select which instance you will be using. That's why please check the Your Server value each time you login. In normal environment it should be possible to echo the value as you suspected.

I see, confirm it is same server every time, thank you for the help, would add support in next release, you can remove the server.

<!-- gh-comment-id:1722610309 --> @zxdong262 commented on GitHub (Sep 18, 2023): > Nope, in this specific case it used to select which instance you will be using. That's why please check the `Your Server` value each time you login. In normal environment it should be possible to echo the value as you suspected. I see, confirm it is same server every time, thank you for the help, would add support in next release, you can remove the server.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/electerm#1912
No description provided.