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
435 stars 112 forks source link

Not able to write a lshell script #157

Open phalgunsirga opened 7 years ago

phalgunsirga commented 7 years ago

Hi,

This utility is cool, addressing almost all my needs, thank you :+1: .

Am trying to write a lshell script(the way we have bash script on bash) to execute in my lshell as an executable, but am facing the below problem.

Traceback (most recent call last): File "/usr/bin/lshell", line 52, in main() File "/usr/bin/lshell", line 42, in main cli.cmdloop() File "/usr/lib64/python2.7/site-packages/lshell/shellcmd.py", line 266, in cmdloop stop = self.onecmd(line) File "/usr/lib64/python2.7/site-packages/lshell/shellcmd.py", line 409, in onecmd func = getattr(self, 'do_' + cmd) File "/usr/lib64/python2.7/site-packages/lshell/shellcmd.py", line 201, in getattr self.retcode = utils.exec_cmd(self.g_line) File "/usr/lib64/python2.7/site-packages/lshell/utils.py", line 92, in exec_cmd proc = subprocess.Popen([cmd], shell=True) File "/usr/lib64/python2.7/subprocess.py", line 679, in init errread, errwrite) File "/usr/lib64/python2.7/subprocess.py", line 1245, in _execute_child child_exception = pickle.loads(data) File "/usr/lib64/python2.7/pickle.py", line 1382, in loads return Unpickler(file).load() File "/usr/lib64/python2.7/pickle.py", line 858, in load dispatchkey File "/usr/lib64/python2.7/pickle.py", line 971, in load_string self.append(rep.decode("string-escape")) LookupError: no codec search functions registered: can't find encoding

Below is my example script:

!/usr/bin/lshell

echo "TEST"

Can you please help.

Thanks and regards, Phalgun.

ghantoos commented 7 years ago

Hi!

This is a great feature request! I had not thought of using lshell this way. Unfortunately, this is not implemented yet. I will try to look into it. :)