New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict exit #156

Closed
guanana opened this Issue Sep 14, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@guanana

guanana commented Sep 14, 2016

Is any possibility that we can restrict exit command in lshell? I'm having env problems trying to login directly with lshell. One solution could be define the shell as bash and then execute lshell. It works perfect, the only problem... the user can just execute exit and come back to the bash. I tried adding exit in the forbidden commands but doesn't work. I also commented in the file /usr/lib/python2.6/site-packages/lshell.py this lines:

148:        #if self.g_cmd in ['quit', 'exit', 'EOF']:
149:        #    self.log.error('Exited')
150:        #    if self.g_cmd == 'EOF':
151:        #        self.stdout.write('\n')
152:       #    sys.exit(0)

No luck neither.

Could you please tell me if is a feature it exists? Am I editing the incorrect file?

@ghantoos

This comment has been minimized.

Show comment
Hide comment
@ghantoos

ghantoos Sep 19, 2016

Owner

This feature is not implemented for the moment. I will add it to the wishilist.

Were you able to find a temporary solution?

Owner

ghantoos commented Sep 19, 2016

This feature is not implemented for the moment. I will add it to the wishilist.

Were you able to find a temporary solution?

@ghantoos

This comment has been minimized.

Show comment
Hide comment
@ghantoos

ghantoos Sep 19, 2016

Owner

@guanana you just need to comment #sys.exit(0), the rest of the lines need to be uncommented to catch the "exit"

Owner

ghantoos commented Sep 19, 2016

@guanana you just need to comment #sys.exit(0), the rest of the lines need to be uncommented to catch the "exit"

@ghantoos ghantoos closed this in f693b98 Sep 19, 2016

ghantoos added a commit that referenced this issue Sep 19, 2016

Merge pull request #158 from ghantoos/f_disable_exit
[feature] add possibility to disable exit (Closes #156)
@guanana

This comment has been minimized.

Show comment
Hide comment
@guanana

guanana Sep 26, 2016

Even with your solution I'm unable to avoid the exit

centos-server ~ $ grep -A5 quit /usr/lib/python2.6/site-packages/lshell.py
        if self.g_cmd in ['quit', 'exit', 'EOF']:
            self.log.error('Exited')
            if self.g_cmd == 'EOF':
                self.stdout.write('\n')
        #    sys.exit(0)

centos-server ~ $ lshell

Welcome to your shell
Type '?' or 'help' to get a list of allowed commands

Contact support@company.com with any queries or problems
viewlogs:~$ exit
centos-server ~ $
centos-server ~ $ lshell --version
lshell-0.9.18 - Limited Shell

guanana commented Sep 26, 2016

Even with your solution I'm unable to avoid the exit

centos-server ~ $ grep -A5 quit /usr/lib/python2.6/site-packages/lshell.py
        if self.g_cmd in ['quit', 'exit', 'EOF']:
            self.log.error('Exited')
            if self.g_cmd == 'EOF':
                self.stdout.write('\n')
        #    sys.exit(0)

centos-server ~ $ lshell

Welcome to your shell
Type '?' or 'help' to get a list of allowed commands

Contact support@company.com with any queries or problems
viewlogs:~$ exit
centos-server ~ $
centos-server ~ $ lshell --version
lshell-0.9.18 - Limited Shell
@ghantoos

This comment has been minimized.

Show comment
Hide comment
@ghantoos

ghantoos Sep 26, 2016

Owner

@guanana what version of lshell are you running?

Owner

ghantoos commented Sep 26, 2016

@guanana what version of lshell are you running?

@guanana

This comment has been minimized.

Show comment
Hide comment
@guanana

guanana Sep 26, 2016

It is on the previous comment @ghantoos , 0.9.18

guanana commented Sep 26, 2016

It is on the previous comment @ghantoos , 0.9.18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment