SYD-PTY(1)
π syd-pty β bestie's guide to the PTY-to-STDIO glow-up
okay so welcome to SYD-PTY(1), from the General Commands Manual section 1, and honestly? this little icon is a PTY to STDIO bidirectional forwarder and it's lowkey doing the most. let me walk you through it π«Ά
β¨ NAME β¨
syd-pty β a PTY to STDIO bidirectional forwarder. that's it, that's the vibe: it takes data from one side and forwards it to the other, both directions, no cap π«
πΈ SYNOPSIS πΈ
syd-pty [-dh] -i <pty-fd> [-x <x-size>] [-y <y-size>]
like, that's the whole summoning ritual. -i is the only thing you truly need π
π¦ DESCRIPTION π¦
Forwards data between the given pty(7) main file descriptor and stdio(3).
literally just that. it's a little relay goblin sitting between your terminal and your standard in/out/err, passing bytes back and forth like notes in class π
π OPTIONS π
-hβ Display help. your little "what do" button π₯Ί-dβ Run in debug mode without confinement. heads up: this is permitted only if Syd is built with the trusted Cargo feature. so like, not always an option, check first π¨-ipty-fdβ PTY main file descriptor. the main character argument, fr fr π-xx-sizeβ Specify window row size (default: inherit). β¨-yy-sizeβ Specify window column size (default: inherit). β¨
π USAGE π
okay bestie, real talk: syd-pty(1) is not meant to be used as a standalone tool. it's not that kind of girl. Syd invokes syd-pty(1) at startup when PTY sandboxing is set to on with sandbox/pty:on. for the full tea, see the PTY SANDBOXING section in the syd(7) manual page π
but if you do want to use syd-pty(1) in your own project? absolutely slay, here's how: create a new pseudoterminal with posix_openpt(3) or openpty(3) and pass the main end of the file descriptor pair to syd-pty(1) with the -i <pty-fd> argument. easy π
π¨ important caveat, do not skip this: syd-pty(1) is going to set the terminal to raw mode and makes no attempt to save/reset original terminal settings β that's the caller's responsibility. so like, your terminal, your problem, no takebacks π
π§ IMPLEMENTATION π§
syd-pty(1) is designed for performance, security, and privacy, and it ate, honestly:
- it uses edge-triggered
epoll(7)for event notification β‘ - fully asynchronous operations to handle pseudoterminal activities without blocking
- it transfers data with zero-copy
splice(2), moving bytes directly between file descriptors within the kernel without exposing plaintext in user space β privacy queen π - two pairs of pipes carry bidirectional traffic between
pty(7)andstdio(3)π° - the execution environment is confined with
seccomp(2)andlandlock(7), restricting system calls and file access to the minimum required
like the way it just... does all that. obsessed π«Ά
π₯ SECURITY π₯
syd-pty(1) applies multiple confinement layers to mitigate risks associated with running outside the Syd sandbox, preventing potential Meddler-in-the-Middle (MITM) attacks against containers. not today, meddler π
here's the stack, bestie:
- Linux
capabilities(7)are dropped early and the no-new-privs attribute is set, so no unwanted capability leaks into the process - the TOSTOP flag is set for the terminal
syd-pty(1)reads from, to disable background processes from writing - resource limits β
RLIMIT_CORE,RLIMIT_FSIZE,RLIMIT_NOFILE,RLIMIT_NPROC,RLIMIT_LOCKS,RLIMIT_MEMLOCK, andRLIMIT_MSGQUEUEβ are set to zero to prevent core dumps and file/fd/process/msgqueue creation inside the main loop seccomp(2)filters are configured to allow only required syscalls β and that list excludes memory, file system and network system calls π«landlock(7)andnamespaces(7), if available, enforce further restrictions by disallowing all filesystem and network access, providing an additional layer of security- the root directory is moved into
/proc/self/fdinfowithpivot_root(2)and the old root is detached withMNT_DETACH, so no path to the host filesystem remains in the mount namespace π³οΈ
these combined techniques ensure that even if syd-pty(1) is compromised, the scope of malicious actions is significantly limited, maintaining integrity and security of the system. that's the whole point, and it's giving fortress π°β¨
π ENVIRONMENT π
SYD_PTY_DEBUGβ Run in debug mode without confinement, equivalent to the-doption. heads up: this is ignored unless Syd is built with the trusted Cargo feature π
π BUGS π
okay so this one's a whole saga. splice(2) support for ttys was removed in commit 36e2c7421f02a22f71c9283e55fdb672a9eb58e7 (merged for Linux 6.5) and later restored in commit 9bb48c82aced07698a2d08ee0f1475a6c4f6b266 (merged for Linux 6.6) π
when running under a problematic Linux kernel, syd-pty(1) will exit with 22, aka EINVAL or Invalid argument. so if you're getting ghosted by exit code 22, that's why, it's the kernel not you π«
see following links for more information:
- https://git.kernel.org/linus/36e2c7421f02a22f71c9283e55fdb672a9eb58e7
- https://git.kernel.org/linus/9bb48c82aced07698a2d08ee0f1475a6c4f6b266
β SEE ALSO β
syd(1), syd(2), syd(7), stdio(3), pty(7)
syd homepage: https://sydbox.exherbo.org/
π AUTHORS π
Maintained by Ali Polatel. Up-to-date sources can be found at https://gitlab.exherbo.org/sydbox/sydbox.git and on Radicle at rad:z38HCnbmcDegA2BMxuPaPRPMdp6wF. Bugs/patches can be submitted to https://gitlab.exherbo.org/groups/sydbox/-/issues. Discuss in #sydbox on Libera Chat or in #sydbox:mailstation.de on Matrix π¬
and that's the whole page bestie π this was the General Commands Manual edition, dated 2026-09-01 β periodt, go forward some PTYs responsibly πΈπ
β¨
π¦ where this page comes from
- arch rolling: syd 3.59.0-1 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms