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

using fabric in a lshell #85

Closed MuschPusch closed 10 years ago

MuschPusch commented 10 years ago

Hey, do you know if it's possible in some way to use fabric to execute commands in a lshell environment? I tried setting up the environment shell in fabric to '/usr/bin/lshell' but it doesn't work.

ghantoos commented 10 years ago

Hey,

I have just managed to make it work by setting env.use_shell = False in my fabfile, and --no-pty on the command-line.

Here is my fabfile:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from fabric.api import *
import sys

env.user = 'machi'
env.hosts = ['localhost']
env.use_shell = False

@task
def testing():
    run("ls")

Running:

mazzika:/tmp$ fab --no-pty -f fabtest.py testing
[localhost] Executing task 'testing'
[localhost] run: ls
[localhost] out: Desktop
...
[localhost] out: Videos
[localhost] out: 

Done.
Disconnecting from localhost... done.

Hope this helps!

MuschPusch commented 10 years ago

thanks a lot!