Add support of SendEnv

Advertisement

Advertisement

alexflex25
Guest

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.

Reply with quote

alexflex25
Guest

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.

Reply with quote

Advertisement

martin
Site Admin
martin avatar

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".

Reply with quote

alexflex25
Guest

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??

Reply with quote

martin
Site Admin
martin avatar

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.

Reply with quote

Advertisement

You can post new topics in this forum