How to add SetEnv in SFTP-settings?

Support for Android version of Total Commander

Moderators: white, Hacker, petermad, Stefan2

User avatar
Spz2022
Junior Member
Junior Member
Posts: 6
Joined: 2022-06-24, 04:57 UTC

How to add SetEnv in SFTP-settings?

Post by *Spz2022 »

How to add SetEnv
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: How to add SetEnv in Sftp ?

Post by *ghisler(Author) »

You can now send commands from a button also to the SFTP plugin.
Function type: send shell command
Command: sh <- MUST always be just sh
Parameters: The actual command. Start with ? to get confirmation dialog, start with * to get result as dialog, ?* for both. You can use all placeholders like %N for the first selected file.
Author of Total Commander
https://www.ghisler.com
User avatar
Spz2022
Junior Member
Junior Member
Posts: 6
Joined: 2022-06-24, 04:57 UTC

Re: How to add SetEnv in Sftp ?

Post by *Spz2022 »

ghisler(Author) wrote: 2023-07-12, 14:34 UTC You can now send commands from a button also to the SFTP plugin.
Function type: send shell command
Command: sh <- MUST always be just sh
Parameters: The actual command. Start with ? to get confirmation dialog, start with * to get result as dialog, ?* for both. You can use all placeholders like %N for the first selected file.
I mean specifying it on settings, not after connecting.
JOUBE
Power Member
Power Member
Posts: 1478
Joined: 2004-07-08, 08:58 UTC

Re: How to add SetEnv in Sftp ?

Post by *JOUBE »

Spz2022 wrote: 2023-07-13, 04:01 UTC
ghisler(Author) wrote: 2023-07-12, 14:34 UTC You can now send commands from a button also to the SFTP plugin.
Function type: send shell command
Command: sh <- MUST always be just sh
Parameters: The actual command. Start with ? to get confirmation dialog, start with * to get result as dialog, ?* for both. You can use all placeholders like %N for the first selected file.
I mean specifying it on settings, not after connecting.
It would be enough for me as described. But how and where exactly do I enter it?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: How to add SetEnv in SFTP-settings?

Post by *ghisler(Author) »

I mean specifying it on settings, not after connecting.
Unfortunately the plugin doesn't allow to send user commands when connecting, sorry.
It would be enough for me as described. But how and where exactly do I enter it?
Lower button bar: Press the rightmost button. If it opens a secondary button bar, click on the "+" button. Then enter the details as described above.
Author of Total Commander
https://www.ghisler.com
User avatar
Spz2022
Junior Member
Junior Member
Posts: 6
Joined: 2022-06-24, 04:57 UTC

Re: How to add SetEnv in SFTP-settings?

Post by *Spz2022 »

This is true, but some ssh needs to be authenticated by
SetEnv.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: How to add SetEnv in SFTP-settings?

Post by *ghisler(Author) »

Can you give me more details, please? SetEnv just sets an environment variable, what does it have to do with authentication? You can't send shell commands before being logged in!
Author of Total Commander
https://www.ghisler.com
User avatar
Spz2022
Junior Member
Junior Member
Posts: 6
Joined: 2022-06-24, 04:57 UTC

Re: How to add SetEnv in SFTP-settings?

Post by *Spz2022 »

like this
ssh -o "SetEnv SECRET=XXX" root@8lgm.segfault.net
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: How to add SetEnv in SFTP-settings?

Post by *ghisler(Author) »

Sorry, I don't see how this would work before logging in. SSH just creates a remote shell, but you can't send commands until you are fully logged in.
Author of Total Commander
https://www.ghisler.com
User avatar
Spz2022
Junior Member
Junior Member
Posts: 6
Joined: 2022-06-24, 04:57 UTC

Re: How to add SetEnv in SFTP-settings?

Post by *Spz2022 »

JOUBE
Power Member
Power Member
Posts: 1478
Joined: 2004-07-08, 08:58 UTC

Re: How to add SetEnv in SFTP-settings?

Post by *JOUBE »

ghisler(Author) wrote: 2023-07-25, 07:45 UTC Sorry, I don't see how this would work before logging in. SSH just creates a remote shell, but you can't send commands until you are fully logged in.
"ssh -o SetEnv...." is part of standard implementation of ssh: (e.g. https://linuxcommand.org/lc3_man_pages/ssh1.html : -o option). and will be "piped" to ssh *) if you use it with scp -o ... . But if it works with the lib I do not know.

*) and how it is handled than from/between ssh and sshd its there part...
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: How to add SetEnv in SFTP-settings?

Post by *ghisler(Author) »

2JOUBE
What do you mean with "piped to ssh"? To send commands via SSH, you have to open a channel through which you can then send shell commands like setenv. Do you mean that ssh -o SetEnv doesn't need a channel to send commands to the server?
Author of Total Commander
https://www.ghisler.com
JOUBE
Power Member
Power Member
Posts: 1478
Joined: 2004-07-08, 08:58 UTC

Re: How to add SetEnv in SFTP-settings?

Post by *JOUBE »

ghisler(Author) wrote: 2023-07-25, 08:11 UTC 2JOUBE
What do you mean with "piped to ssh"? To send commands via SSH, you have to open a channel through which you can then send shell commands like setenv. Do you mean that ssh -o SetEnv doesn't need a channel to send commands to the server?
As i have written in my edited (at the same time you answered) post: *) and how it is handled than from/between ssh and sshd its there part...

And it is not your part... and it is used IIRC for the separation of different users within the login process.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: How to add SetEnv in SFTP-settings?

Post by *ghisler(Author) »

I found something in RFC 4254, is it that?
https://datatracker.ietf.org/doc/html/rfc4254#section-6.4

But it also requires a channel as parameter.
Author of Total Commander
https://www.ghisler.com
JOUBE
Power Member
Power Member
Posts: 1478
Joined: 2004-07-08, 08:58 UTC

Re: How to add SetEnv in SFTP-settings?

Post by *JOUBE »

ghisler(Author) wrote: 2023-07-25, 08:17 UTC I found something in RFC 4254, is it that?
https://datatracker.ietf.org/doc/html/rfc4254#section-6.4

But it also requires a channel as parameter.
All this is not your part. You only have to support the -o option. Im not sure this is possible with the lib. Or if you handle the login via the login yourself then you have to check how to handle option "setenv" with the lib. But all the -o options works with ssh itself.
Last edited by JOUBE on 2023-07-25, 08:43 UTC, edited 4 times in total.
Post Reply