-
Notifications
You must be signed in to change notification settings - Fork 23
[App] run system commands
HouzuoGuo edited this page Dec 18, 2023
·
5 revisions
Via any of enabled laitos daemons, you may run operating system (shell) commands. This works on all OS platforms supported by laitos.
This app is always enabled for use in the default configuration, which restricts command execution to these programs without additional parameters:
- arch arp blkid cal date df dmesg dnsdomainname false free
- groups hostid hostname id ifconfig ipconfig iostat ipcs
- kbd_mode ls lsof lspci lsusb mpstat netstat nproc
- ps pstree pwd route stty tty uname uptime whoami
To customise configuration, under JSON object Features
, construct a JSON
object called Shell
that has the following mandatory properties:
Property | Type | Meaning | Default value |
---|---|---|---|
InterpreterPath | string | Absolute path to the system shell interpreter, such as /bin/bash. | Automatically detected, e.g. bash, powershell. |
Unrestricted | true/false | When true, allow executing arbitrary commands incl. CLI parameters. | False - only allow executing predefined & hard-coded commands. |
Here is an example:
{ ... "Features": { ... "Shell": { "InterpreterPath": "/bin/bash", "Unrestricted": true }, ... }, ... }
Use any capable laitos daemon to invoke the app:
.s shell-command
The shell command may use shell interpreter's capabilities to their full extend. For example, the following command will find system users whose name contains "howard" and store them in an output file:
.s cat /etc/passwd | grep howard > output.txt
- When
InterpreterPath
is left empty, laitos will automatically look for a shell interpreter from/bin
,/usr/bin
,/usr/local/bin
,/opt/bin
, laitos recognisesbash
,dash
,zsh
,ksh
,ash
,tcsh
,csh
,sh
. - On Windows, laitos uses PowerShell by default, unless an alternative shell interpreter is specified in configuration.
- On Linux, the
PATH
is hard-coded to/tmp/laitos-util:/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/usr/local/bin:/usr/local/sbin:/opt/bin:/opt/sbin
when executing shell commands. - laitos automatically copies some non-essential executables such as busybox and
toybox into
/tmp/laitos-util
.
Table of Contents
- Home
- Get started
- Component list
- Tips for running on public cloud
- Tips for using apps over satellite
- laitos terminal
Daemon Components
- DNS server
- Mail server
- Web server
- Web proxy server
- Telnet server
- Telegram chat-bot
- Simple IP services server
- SNMP server
- System maintenance
- Phone home telemetry
Web Service Components
- Twilio telephone/SMS hook
- Microsoft chat bot hook
- The Things Network LORA tracker integration
- Recurring commands
- App command form
- Simple app command execution API
- GitLab browser
- Temporary file storage
- Simple web proxy
- Desktop on a page (virtual machine)
- Read telemetry records
- Program health report
- System process explorer
- Prometheus metrics exporter
- HTTP request inspector
- HTTP request logger
Apps