'\" t
.\"     Title: flatpak spawn
.\"    Author: Alexander Larsson <alexl@redhat.com>
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 12/18/2025
.\"    Manual: flatpak spawn
.\"    Source: flatpak
.\"  Language: English
.\"
.TH "FLATPAK SPAWN" "1" "" "flatpak" "flatpak spawn"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
flatpak-spawn \- Run commands in a sandbox
.SH "SYNOPSIS"
.HP \w'\fBflatpak\-spawn\fR\ 'u
\fBflatpak\-spawn\fR [OPTION...] COMMAND [ARGUMENT...]
.SH "DESCRIPTION"
.PP
Unlike other flatpak commands,
\fBflatpak\-spawn\fR
is available to applications inside the sandbox\&. It runs
COMMAND
outside the sandbox: either in another sandbox, or on the host\&.
.PP
When called without
\fB\-\-host\fR,
\fBflatpak\-spawn\fR
uses the Flatpak portal to create a copy of the sandbox it was called from, optionally using tighter permissions and optionally the latest version of the app and runtime (see
\fB\-\-latest\-version\fR)\&.
.SH "OPTIONS"
.PP
The following options are understood:
.PP
\fB\-h\fR, \fB\-\-help\fR
.RS 4
Show help options and exit\&.
.RE
.PP
\fB\-v\fR, \fB\-\-verbose\fR
.RS 4
Print debug information
.RE
.PP
\fB\-\-forward\-fd=FD\fR
.RS 4
Forward a file descriptor
.RE
.PP
\fB\-\-clear\-env\fR
.RS 4
Run with a clean environment
.RE
.PP
\fB\-\-watch\-bus\fR
.RS 4
Make the spawned command exit when
\fBflatpak\-spawn\fR
itself exits; notably, this occurs when its connection to the session bus is closed\&.
.RE
.PP
\fB\-\-env=VAR=VALUE\fR
.RS 4
Set an environment variable
.RE
.PP
\fB\-\-latest\-version\fR
.RS 4
Use the latest version of the refs that are used to set up the sandbox
.RE
.PP
\fB\-\-no\-network\fR
.RS 4
Run without network access
.RE
.PP
\fB\-\-sandbox\fR
.RS 4
Run fully sandboxed\&. See the documentation for the
\fB\-\-sandbox\fR
option in
\fBflatpak-run\fR(1)
.sp
See the
\fB\-\-sandbox\-expose\fR
and
\fB\-\-sandbox\-expose\-ro\fR
options for selective file access\&.
.RE
.PP
\fB\-\-sandbox\-expose=NAME\fR
.RS 4
Expose read\-write access to a file in the sandbox\&.
.sp
Note that absolute paths or subdirectories are not allowed\&. The files must be in the
sandbox
subdirectory of the instance directory (i\&.e\&.
~/\&.var/app/$APP_ID/sandbox)\&.
.sp
This option is useful in combination with
\fB\-\-sandbox\fR
(otherwise the instance directory is accessible anyway)\&.
.RE
.PP
\fB\-\-sandbox\-expose\-ro=NAME\fR
.RS 4
Expose readonly access to a file in the sandbox\&.
.sp
Note that absolute paths or subdirectories are not allowed\&. The files must be in the
sandbox
subdirectory of the instance directory (i\&.e\&.
~/\&.var/app/$APP_ID/sandbox)\&.
.sp
This option is useful in combination with
\fB\-\-sandbox\fR
(otherwise the instance directory is accessible anyway)\&.
.RE
.PP
\fB\-\-host\fR
.RS 4
Run the command unsandboxed on the host\&. This requires access to the org\&.freedesktop\&.Flatpak D\-Bus interface\&.
.RE
.PP
\fB\-\-directory=DIR\fR
.RS 4
The working directory in which to run the command\&.
.sp
Note that the given directory must exist in the sandbox or, when used in conjunction with
\fB\-\-host\fR, on the host\&.
.RE
.SH "EXAMPLES"
.PP
\fB$ flatpak\-spawn ls /var/run\fR
.SH "SEE ALSO"
.PP
\fBflatpak\fR(1)
