OnWorks favicon

lshell - Online in the Cloud

Run lshell in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command lshell that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator



lshell - Limited Shell


lshell [OPTIONS]


lshell provides a limited shell configured per user. The configuration is done quite
simply using a configuration file. Coupled with ssh's authorized_keys or with /etc/shells
and /etc/passwd , it becomes very easy to restrict user's access to a limited set of


--config <FILE>
Specify config file

--log <DIR>
Specify the log directory

--<param> <value>
where <param> is *any* config file parameter

-h, --help
Show help message

Show version


You can configure lshell through its configuration file:

On Linux -> /etc/lshell.conf
On *BSD -> /usr/{pkg,local}/etc/lshell.conf

lshell configuration has 4 types of sections:

[global] -> lshell system configuration (only 1)
[default] -> lshell default user configuration (only 1)
[foo] -> UNIX username "foo" specific configuration
[grp:bar] -> UNIX groupname "bar" specific configuration

Order of priority when loading preferences is the following:

1- User configuration
2- Group configuration
3- Default configuration

config path (default is /var/log/lshell/)

0, 1, 2, 3 or 4 (0: no logs -> 4: logs everything)

- set to syslog in order to log to syslog
- set log file name, e.g. %u-%y%m%d (i.e foo-20091009.log): %u -> username
%d -> day [1..31]
%m -> month [1..12]
%y -> year [00..99]
%h -> time [00:00..23:59]

in case you are using syslog, set your logname (default: lshell)

include a directory containing multiple configuration files. These files can only
contain default/user/group configuration. The global configuration will only be
loaded from the default configuration file. This variable will be expanded (e.g.

[default] and/or [username] and/or [grp:groupname]
command aliases list (similar to bash's alias directive)

a list of the allowed commands or set to 'all' to allow all commands in user's PATH

a list of path; all executable files inside these path will be allowed

update the environment variable $PATH of the user (optional)

set environment variables (optional)

a list of forbidden characters or commands

set the history filename. A wildcard can be used:
%u -> username (e.g. '/home/%u/.lhistory')

set the maximum size (in lines) of the history file

home_path (deprecated)
set the home folder of your user. If not specified, the home directory is set to
the $HOME environment variable. This variable will be removed in the next version
of lshell, please use your system's tools to set a user's home directory. A
wildcard can be used:
%u -> username (e.g. '/home/%u')

intro set the introduction to print at login

define the script to run at user login

passwd password of specific user (default is empty)

path list of path to restrict the user geographically. It is possible to use wildcards
(e.g. '/var/log/ap*').

prompt set the user's prompt format (default: username)
%u -> username
%h -> hostname

set sort prompt current directory update - set to 1 or 0 overssh list of command
allowed to execute over ssh (e.g. rsync, rdiff-backup, scp, etc.)

scp allow or forbid the use of scp connection - set to 1 or 0

force files sent through scp to a specific directory

set to 0 to forbid scp downloads (default is 1)

set to 0 to forbid scp uploads (default is 1)

sftp allow or forbid the use of sftp connection - set to 1 or 0.

WARNING: This option will not work if you are using OpenSSH's internal-sftp service
(e.g. when configured in chroot)

a list of the allowed commands that can be used with sudo(8). If set to ´all', all
the 'allowed' commands will be accessible through sudo(8).

It is possible to use the -u sudo flag in order to run a command as a different
user than the default root.

timer a value in seconds for the session timer

strict logging strictness. If set to 1, any unknown command is considered as forbidden,
and user's warning counter is decreased. If set to 0, command is considered as
unknown, and user is only warned (i.e. *** unknown synthax)

number of warnings when user enters a forbidden value before getting exited from
lshell. Set to -1 to disable the counter, and just warn the user.


Here is the set of commands that are always available with lshell:

clear clears the terminal

help, ?
print the list of allowed commands

print the commands history

lpath lists all allowed and forbidden path

lsudo lists all sudo allowed commands


$ lshell
Tries to run lshell using default ${PREFIX}/etc/lshell.conf as configuration file.
If it fails a warning is printed and lshell is interrupted. lshell options are
loaded from the configuration file

$ lshell --config /path/to/myconf.file --log /path/to/mylog.log
This will override the default options specified for configuration and/or log file


The primary goal of lshell, was to be able to create shell accounts with ssh access and
restrict their environment to a couple a needed commands. In this example, User 'foo' and
user 'bar' both belong to the 'users' UNIX group:

User foo:
- must be able to access /usr and /var but not /usr/local
- user all command in his PATH but 'su'
- has a warning counter set to 5
- has his home path set to '/home/users'

User bar:
- must be able to access /etc and /usr but not /usr/local
- is allowed default commands plus 'ping' minus 'ls'
- strictness is set to 1 (meaning he is not allowed to type an unknown command)

In this case, my configuration file will look something like this:

logpath : /var/log/lshell/
loglevel : 2

allowed : ['ls','pwd']
forbidden : [';', '&', '|']
warning_counter : 2
timer : 0
path : ['/etc', '/usr']
env_path : ':/sbin:/usr/bin/'
scp : 1 # or 0
sftp : 1 # or 0
overssh : ['rsync','ls']
aliases : {'ls':'ls --color=auto','ll':'ls -l'}

warning_counter : 5
overssh : - ['ls']

allowed : 'all' - ['su']
path : ['/var', '/usr'] - ['/usr/local']
home_path : '/home/users'

allowed : + ['ping'] - ['ls']
path : - ['/usr/local']
strict : 1
scpforce : '/home/bar/uploads/'


In order to log a user's warnings into the logging directory (default /var/log/lshell/) ,
you must firt create the folder (if it doesn't exist yet) and chown it to lshell group:

# addgroup --system lshell
# mkdir /var/log/lshell
# chown :lshell /var/log/lshell
# chmod 770 /var/log/lshell

then add the user to the lshell group:

# usermod -aG lshell user_name

In order to set lshell as default shell for a user:

On Linux:
# chsh -s /usr/bin/lshell user_name

On *BSD:
# chsh -s /usr/{pkg,local}/bin/lshell user_name

Use lshell online using onworks.net services

Free Servers & Workstations

Download Windows & Linux apps

  • 1
    Fork of TeamWinRecoveryProject(TWRP)
    with many additional functions, redesign
    and more Features:Supports Treble and
    non-Treble ROMsUp-to-date Oreo kernel,
    Download OrangeFox
  • 2
    itop - ITSM  CMDB OpenSource
    itop - ITSM CMDB OpenSource
    IT Operations Portal: a complete open
    source, ITIL, web based service
    management tool including a fully
    customizable CMDB, a helpdesk system and
    a document man...
    Download itop - ITSM CMDB OpenSource
  • 3
    Clementine is a multi-platform music
    player and library organizer inspired by
    Amarok 1.4. It has a fast and
    easy-to-use interface, and allows you to
    search and ...
    Download Clementine
  • 4
    ATTENTION: Cumulative update 2.4.3 has
    been released!! The update works for any
    previous 2.x.x version. If upgrading
    from version v1.x.x, please download and
    Download XISMuS
  • 5
    Modular headtracking program that
    supports multiple face-trackers, filters
    and game-protocols. Among the trackers
    are the SM FaceAPI, AIC Inertial Head
    Tracker ...
    Download facetracknoir
  • 6
    PHP QR Code
    PHP QR Code
    PHP QR Code is open source (LGPL)
    library for generating QR Code,
    2-dimensional barcode. Based on
    libqrencode C library, provides API for
    creating QR Code barc...
    Download PHP QR Code
  • 7
    Cuckoo Sandbox
    Cuckoo Sandbox
    Cuckoo Sandbox uses components to
    monitor the behavior of malware in a
    Sandbox environment; isolated from the
    rest of the system. It offers automated
    analysis o...
    Download Cuckoo Sandbox
  • More »

Linux commands

  • 1
    rsbac-admin - Rule Set Based Access
    Control DESCRIPTION: rsbac-admin is a
    set of tool used to manage systems using
    a Rule Set Based Access Control (RSBAC)
    Run acl_gran
  • 2
    rsbac-admin - Rule Set Based Access
    Control DESCRIPTION: rsbac-admin is a
    set of tool used to manage systems using
    a Rule Set Based Access Control (RSBAC)
    Run acl_grant
  • 3
    cpupower idle-set - Utility to set cpu
    idle state specific kernel options
    SYNTAX: cpupower [ -c cpulist ]
    idle-info [options] DESCRIPTION: The
    cpupower idle-se...
    Run cpupower-idle-set
  • 4
    cpupower-info - Shows processor power
    related kernel or hardware
    configurations ...
    Run cpupower-info
  • 5
    g15daemon - provides access to extra
    keys and the LCD available on the
    logitech G15 keyboard. DESCRIPTION:
    G15Daemon allows users access to all
    extra keys by d...
    Run g15daemon
  • 6
    laditools - tools to control and
    monitor LADI (JACK and ladish) systems ...
    Run g15ladi
  • More »