In short.
E2B’s User and workdir guide helps Python and JavaScript/TypeScript developers configure sandbox execution defaults, but requires SDK 2.3.0 or later and provides only a partial setup example. It documents the default account as user and the starting directory as /home/user, explains that the last template user and working directory persist into sandbox execution, and illustrates switching to guest. Its command outputs are documentation comments; build success, runtime behavior and security properties have not been independently assessed.
Researched and written by an AI model and checked by a second AI model. How it works
Coverage includes the complete page at [https://docs.e2b.dev/template/user-and-workdir.md], its documentation-index notice, SDK requirement, default-security rationale and Python and JavaScript/TypeScript examples. The linked documentation index and all other linked pages are excluded. No code was executed; template builds, sandbox behavior, permissions and security properties remain unverified. Pricing and reuse rights are unknown.
The overview
Identity
This focused E2B documentation page explains the default user account and working directory used in templates and sandbox execution. The original source is User and workdir [https://docs.e2b.dev/template/user-and-workdir.md].
It contains equivalent examples for JavaScript/TypeScript and Python, covering default sandbox creation and a custom template.
Assessment
The guide is useful when a developer needs to understand which account executes commands and where those commands start. Its strongest feature is the sequence connecting template configuration to the defaults shown after creating a sandbox.
It works best as a focused reference alongside fuller setup documentation. Installation, imports, authentication and account provisioning are not explained.
Users
The intended readers are developers creating E2B sandboxes or custom templates in Python or JavaScript/TypeScript. Beginners can use the examples to understand execution identity and starting directories; experienced developers can use them when investigating account-dependent commands or relative file paths.
Familiarity with user accounts, home directories and template building would help readers fill the gaps in the examples.
Capabilities
The page documents the default account, default working directory, changing the template user, building a named template and creating a sandbox from that template. It states that the last configured user and working directory become sandbox execution defaults.
Although custom working directories are part of the topic, the examples demonstrate a user change and its resulting home directory. They do not show an explicit call for choosing an arbitrary directory.
Using it
Requirements
The page explicitly requires E2B SDK version 2.3.0 or later. It does not identify a current release or language-runtime requirements.
The snippets reference Sandbox, Template and build-log helpers without showing their imports or installation. Required credentials, service access and any prerequisites for the guest account are unknown from this page.
Mechanism
A working directory is the folder in which a command starts. The documented defaults are the account user and the directory /home/user; the page contrasts these with Docker defaults it describes as root and /.
The custom template starts from a base image, runs commands showing its initial context, then calls setUser("guest") in JavaScript/TypeScript or set_user("guest") in Python. Subsequent example comments show guest and /home/guest. The page says the final template settings persist into sandbox execution.
Setup
The documented sequence is to define a template from the base image, set its user to guest, build it under the name custom-user-template, then pass that name to Sandbox.create. The build examples attach defaultBuildLogger() or default_build_logger() for build logs.
Before adapting this sequence, readers need to resolve the omitted SDK setup and determine how the chosen account becomes available. The page does not show account creation.
Example
With Sandbox.create() and no template argument, the examples annotate whoami with user and pwd with /home/user. In the custom-template sequence, those annotations change to guest and /home/guest after setting the user.
After building custom-user-template, the examples create a sandbox from it and show the same guest account and home directory. These are expected outputs written in source comments. No commands or builds were executed.
Assessment & evidence
Limitations
The examples omit arbitrary working-directory configuration, account provisioning, permissions, error handling and behavior when the selected account or directory is unavailable. Those details cannot be established from this page.
The page presents the defaults as helping tool installation and improving default security. It supplies no comparative security evidence, permission model or isolation assessment supporting a broader security conclusion.
Reasoning
Persisting the template’s account and starting directory gives developers a documented connection between template configuration and later command execution. A practical implication is that these settings matter when commands depend on home directories or relative paths.
The guest example supports understanding that connection. It does not establish that switching users grants access to particular files, installs tools successfully or creates the account automatically.
Alternatives
The page illustrates two choices: create a sandbox with the documented defaults, or build and select a custom template with a different user. The default path is relevant when user and /home/user meet the application’s needs; the custom path illustrates retaining a different account context.
The Docker comparison explains a difference in defaults. The page does not compare alternative sandbox services or provide a migration guide.
Evidence
The evidence is the complete User and workdir page from E2B’s documentation, including its explanatory text, SDK-version notice and both language examples [https://docs.e2b.dev/template/user-and-workdir.md].
The source supports statements about documented behavior and example structure. It contains no runtime logs, successful-build receipts, benchmarks or independent security findings.
Access & freshness
Costs
The page provides no pricing, billing units, free allowances or plan requirements. Costs for template building and sandbox execution are unknown, and the examples do not establish that either is free.
Rights
The supplied page contains no explicit licence or reuse terms for its prose or code examples. Permission to redistribute the captured page or incorporate its examples under a particular licence is unknown.
Freshness
The available source copy was captured on 15 November 2026 at 12:57:25.807 UTC. The page provides no publication or last-update date.
SDK 2.3.0 is the stated minimum, not evidence of the latest release. Compatibility across individual SDK releases has not been assessed.
Actions
Confirm that your SDK meets the stated minimum and obtain the missing installation, import and authentication details from the applicable E2B documentation. Establish how your chosen account and directory are provisioned before adapting the guest example.
When implementing your own template, check whoami and pwd during template building and after sandbox creation to verify the intended account and starting directory. Check current service pricing and applicable reuse terms separately.
