SRV(4)

πŸ“¦ version 0_git20260208, in alpine 3.24, arch rolling, nixos 26.05, nixpkgs unstable

πŸ’… SRV(4) β€” like, the network file service glow-up

okay so bestie, welcome to srv and 9fs, the Kernel Interfaces Manual's own little duo for starting a network file service ✨ this is the page that makes remote files just... appear in your namespace. iconic behavior, honestly.


🌸 SYNOPSIS 🌸

srv [ -an ] [ -k keypattern ] address [ srvname ]

9fs system

that's the whole vibe check β€” an address, an optional name for it, and a couple flags. slay.


πŸ¦‹ DESCRIPTION πŸ¦‹

So srv dials the given address and initializes the connection so it serves the 9P protocol. Then β€” and this is the main character moment β€” it posts the resulting connection in the current name space (peep intro(4) if you need the lore) as srvname, which defaults to address. so if you don't name your baby, it just goes by the address it came from. lowkey poetic πŸŽ€

  • -a β€” causes srv to post a pre-authenticated connection to the file system aname (by default, the empty string β€” see attach(9p)). like, the auth is already done, no need to ask again πŸ’…
  • -n β€” causes srv to reject authentication attempts by clients. super useful if the remote server is known not to require authentication β€” no cap, why make everyone do the little auth dance for nothing? πŸ™ˆ

Srv authenticates over the 9P connection to establish a valid auth fid. If keypattern is specified, it's used to select the key used for authentication. And then the plot twist: client attach requests are rewritten to use the specified aname and auth fid β€” so everybody who attaches gets the same treatment. fr fr πŸ”₯

Now for the bestie: the 9fs command executes the srv necessary to make available the files of system. one command, whole file system, periodt.

9fs recognizes some special names, such as sources, to make the file server sources.cs.bell-labs.com available as service sources. Also important, ngl: 9fs is an rc(1) script β€” so go examine it to see what local conventions apply, because your machine might have its own little quirks. iykyk 🧚

lowkey a reminder: 9fs is a script, so don't assume it's doing exactly what some other machine's script does. read it. it's giving "trust but verify" πŸ’€

πŸ’– EXAMPLES πŸ’–

List the root directory on sources:

9fs sources
9p ls sources

Mount a remote file server bootes on Linux using the kernel 9P mount driver, with srv handling authentication:

srv -a sources.cs.bell-labs.com sources
sudo mount -t 9p -o trans=unix,uname=$USER,dfltuid=`id -u`,dfltgid=`id -g`
           `namespace`/sources /n/sources

that second one is the whole flex β€” srv does the auth, the kernel driver does the mounting, and you get /n/sources. obsessed 🫢


⭐ SOURCE ⭐

/src/cmd/srv.c
/bin/9fs

πŸŽ€ SEE ALSO πŸŽ€

dial(3), intro(4), netfiles(1)


and that's the page, bestie 🌈 straight from the Kernel Interfaces Manual, filed under SRV(4) β€” go forth and post some connections, you gorgeous nerd πŸ’œπŸ¦‹βœ¨