How to add SetEnv in SFTP-settings?

Support for Android version of Total Commander

Moderators: white, Hacker, petermad, Stefan2

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

Re: How to add SetEnv in SFTP-settings?

Post by *JOUBE »

This special type of login has a special name, but I do not remember the name at the moment and have not time at the moment for searching it.
JOUBE
Power Member
Power Member
Posts: 1477
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
Yes,I think so, And if so, it seams easy to implement, i think.

It is a command to sshd and not after login a command to the shell.
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) »

No, it requires a channel id, which can only be acquired after login.
Author of Total Commander
https://www.ghisler.com
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: How to add SetEnv in SFTP-settings?

Post by *JOUBE »

PermitUserEnvironment is a keyword in this topic.
ssh -vvv -o "SetEnv=foo=bar" user@10.1.1.1 2>&1 | tee vvv.log

Yes, after login (see part of vvv.log):

Code: Select all

....
debug3: send packet: type 98
debug1: Sending environment.
debug3: Ignored env SHELL
debug3: Ignored env QT_ACCESSIBILITY
debug3: Ignored env COLORTERM
debug3: Ignored env XDG_CONFIG_DIRS
debug3: Ignored env XDG_MENU_PREFIX
debug3: Ignored env _LXSESSION_PID
debug3: Ignored env SSH_AUTH_SOCK
debug3: Ignored env XDG_DATA_HOME
debug3: Ignored env XDG_CONFIG_HOME
debug3: Ignored env DESKTOP_SESSION
debug3: Ignored env SSH_AGENT_PID
debug3: Ignored env XKL_XMODMAP_DISABLE
debug3: Ignored env GTK_MODULES
debug3: Ignored env PWD
debug3: Ignored env LOGNAME
debug3: Ignored env XDG_SESSION_TYPE
debug3: Ignored env GPG_AGENT_INFO
debug3: Ignored env MOTD_SHOWN
debug3: Ignored env HOME
debug1: channel 0: setting env LANG = "de_DE.UTF-8"
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env LS_COLORS
debug3: Ignored env XDG_CURRENT_DESKTOP
debug3: Ignored env VNCDESKTOP
debug3: Ignored env VTE_VERSION
debug3: Ignored env SSH_CONNECTION
debug3: Ignored env XDG_SESSION_CLASS
debug3: Ignored env TERM
debug3: Ignored env USER
debug3: Ignored env DISPLAY
debug3: Ignored env SHLVL
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env XDG_RUNTIME_DIR
debug3: Ignored env SSH_CLIENT
debug3: Ignored env XDG_DATA_DIRS
debug3: Ignored env PATH
debug3: Ignored env SAL_USE_VCLPLUGIN
debug3: Ignored env DBUS_SESSION_BUS_ADDRESS
debug3: Ignored env _
debug1: channel 0: setting env foo = "bar"
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug2: channel 0: request shell confirm 1
....
A little note on the term login in this case: For me, login is the generic term for the entire process until the connection has been completely established. So this includes the part described by the code (and you see the term channel here). And is not a subsequent shell command.

Edit: Text removed and added, log added
Last edited by JOUBE on 2023-07-25, 19:13 UTC, edited 6 times in total.
Post Reply