ghantoos / lshell

lshell is a shell coded in Python, that lets you restrict a user's environment to limited sets of commands, choose to enable/disable any command over SSH (e.g. SCP, SFTP, rsync, etc.), log user's commands, implement timing restriction, and more.
GNU General Public License v3.0
436 stars 111 forks source link

lshell close Connection after one command #92

Closed LamesSeulJames closed 8 years ago

LamesSeulJames commented 9 years ago

i'm running on FreeBSD 10.0-RELEASE with lshell-0.9.16 package. If i hit 'ls' , result is ok, but if i hit 'ls' one more, lshell close connection with message "Connection to FQDN closed."

it's the same problem with other allowed command.

But if i hit '?' several, connection still up.

i activate log, but no file create.

i have make a mistake ?

could you help me please ?

you can read my conf on http://pastebin.com/m4gVMdyd

ghantoos commented 9 years ago

Hi,

Do you have the same result when when launching lshell locally?

I don't currently have a FreeBSD to test this. It works fine on my debian.

(sorry for the delayed response)

berzia commented 8 years ago

Hi,

I have the same problem. I'm running on FreeBSD 10.2-RELEASE with lshell-0.9.16 and when I hit one command, Lshell close connection without any message. I have the same problem when I use it in local except that Lshell close with this message " Suspended (tty output)"

xlr-8 commented 8 years ago

@LamesSeulJames in your configuration apparently you specified no file, nor log level, which might explain why you don't have a logfile. @berzia Could you configure lshell to have a logfile with more output maybe?

It might tell more why is the connection being closed.

ghantoos commented 8 years ago

I was able to reproduce the bug on a vagrant FreeBSD 10.2-RELEASE box, using the available lshell package. I discovered this is due to a commit that was reverted that added set -m to all the executed commands (https://github.com/ghantoos/lshell/commit/b4f48136aee01bf387915e4b0fc750ee655b3afe).

There are two possible solutions:

1) To patch the file on your system (tested on my FreeBSD vm):

sed -i.bak 's/set -m; //' /usr/local/lib/python2.7/site-packages/lshell/shellcmd.py

2) The problem does not appear in the latest version of lshell. You can try it the following (using bash):

git clone https://github.com/ghantoos/lshell.git
cd lshell/
sed -i.bak 's,/usr/bin/env python,/usr/local/bin/python2.7,' bin/lshell
export PYTHONPATH=$PWD
./bin/lshell

Do you confirm either of these options solve your issue?

ghantoos commented 8 years ago

I have filed a bug on the FreeBSD bugzilla to have this corrected in the official package: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=208003

berzia commented 8 years ago

Hi,

thank you for your quick responses . Your first solution, Ghantoos, works perfectly.

Thanks again.

ghantoos commented 8 years ago

@berzia great! :)

I wil close this bug, as a bug report has been filed for FreeBSD to correct this in their official package. Thanks for re-opening this report.