Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: env variable are missing

$
0
0
I had a similar issue with missing env.
i thought about changing the default sshd provided env, but it seemed too hard to maintain.
so instead, i just modify the command i want to call, with all the exports i need first.

e.g. assume my problem is in a missing path and i need the path to be /bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/local/bin

then,
instead of the following code: (assume Cmd = "/usr/local/bin/myscript.sh"
string Cmd = "/usr/local/bin/myscript.sh"
vat cmd = client.CreateCommand(Cmd);
var asynch = cmd.BeginExecute();


string Cmd = "/usr/local/bin/myscript.sh"
Cmd = "export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/local/bin ; " + Cmd;
vat cmd = client.CreateCommand(Cmd);
var asynch = cmd.BeginExecute();


i tried this, and it works well with multiple number of exports, chained with semi-column.

one can extend that to an full env , spread as a big line with semi-column and thus compensating for the missing environment.

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>