AbhishekGhosh / shellinabox

Automatically exported from code.google.com/p/shellinabox
Other
0 stars 0 forks source link

Executing command with pipe breaks. #104

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. What I'm trying to do is record all session data being passed back and 
fourth into a file.  When starting Shellinabox I create the 
/etc/default/shellinabox file with the commands I need. I'm Trying to pipe the 
output to a file using the tee command.  The /etc/default/shellinabox works 
great if I do not use the pipe "|" tee command.  When I try to use the pipe 
command to access a device "router" the terminal displays "Line has invalid 
autocommand "| tee /var/www/termlog/test".  Why does the pipe break the command 
and how can i make this work?  I've tried various ways to escape and quote the 
command but nothing works.  

SHELLINABOX_DAEMON_START=1
SHELLINABOX_PORT=4200
SHELLINABOX_ARGS=" -f http://webhost/Views/js/ShellInABox.js  -s 
/18:::/var/www:'sshpass -p password ssh user@192.168.1.1 | tee 
/var/www/termlog/test' 

What is the expected output? What do you see instead?
To pipe all session data into an output file. When using the pipe command the 
command breaks.

What version of the product are you using? On what operating system?
Ubuntu 10.04, ShellInABox 2.10

Please provide any additional information below.

Original issue reported on code.google.com by kdmcve...@gmail.com on 21 Dec 2010 at 9:53

GoogleCodeExporter commented 9 years ago
The pipe command is usually interpreted by the shell. But you are not invoking 
any shell. You can either call "/bin/sh -c" and pass it your command line 
(making sure you get all the quoting right), or you can write a small helper 
script. The latter is likely going to be much easier and more maintainable.

Original comment by zod...@gmail.com on 21 Dec 2010 at 10:11

GoogleCodeExporter commented 9 years ago
My goal is much simple - to enable to autlogin users to their servers from a 
single machine with Shell in a box. Does "SHELLINABOX_ARGS=" -f 
http://webhost/Views/js/ShellInABox.js  -s /18:::/var/www:'sshpass -p password 
ssh user@192.168.1.1 | tee /var/www/termlog/test' " really work?

Original comment by foranyc...@gmail.com on 26 Sep 2014 at 11:23