Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

alexflex25

Re: Add support of SendEnv

Ok, it works.
martin

Re: Add support of SendEnv

alexflex25 wrote:

Sorry, but I don't understand, how my script can get sftp-server as its argument??

The SSH server should pass sftp-server to the shell as an argument.
alexflex25

Re: Add support of SendEnv

Thanks for your responses, and happy new year!

martin wrote:

I was asking, why do you start /bin/bash in your main.sh, if "mode" is "SFTP".


to start /bin/bash instead of my whiptail script.

martin wrote:

Anyway, your main.sh should get sftp-server as its argument. You can use that to detect the "mode".


Sorry, but I don't understand, how my script can get sftp-server as its argument??
martin

Re: Add support of SendEnv

I was asking, why do you start /bin/bash in your main.sh, if "mode" is "SFTP".

Anyway, your main.sh should get sftp-server as its argument. You can use that to detect the "mode".
alexflex25

Re: Add support of SendEnv

Yes, but if it's not a shell (eg bash) that is started at the connection.

like this:
foo:x:1001:1001:,,,:/home/foo:/home/foo/main.sh


Winscp can not connect.
martin

Re: Add support of SendEnv

How does bash relate to SFTP? You need to start sftp-server, not bash.
alexflex25

Add support of SendEnv

The user (foo) that I use to connect to my server does not have a bash by default, but a script (whiptail, to facilitate common actions). Unless the environment variable MODE = "SFTP"

/etc/passwd
...

foo:x:1001:1001:,,,:/home/foo:/home/foo/main.sh
...


home/foo/main.sh
...

if [["$ {MODE}" == "SFCP"]]
 Then
     /bin/bash
 fi
...


To be able to use the same user to upload and manage my server, I would like to use sendEnv.
martin

Re: Add support of SendEnv

What's the use case with SFTP protocol?
alexflex25

Add support of SendEnv

Add support of SendEnv to set environment variable at connection in SFTP(like putty)