SD Core for Linux LC2.0-0

Security and the operating system

Reaching the machine from inside SD, how privileged work is done, and the audit trail.

This page continues Security.

The shell and operating-system access are per-account switches#

SD is delivered with the ways out of SD shut, and the administrator opens them one account at a time. A new user account has none of these until SDSYS turns it on (modify.account name sh-on / os-on):

What it is The switch
sh a shell at the : prompt sh-on
OS.EXECUTE the operating system from inside a BASIC program os-on
micro a text editor, running outside SD os-on
the embedded Python arbitrary code in the account's own process os-on
a file or directory of the operating system by its path, outside the account's own directory OPENSEQ and OPENPATH with a path, DIR() and select.dir, DELETESEQ of a path, !OSCOPY, !IOSCOPY and the oscopy verb, sed given a path: name, printing into a file by path os-on

sed is not in the table: it runs inside SD, so editing a record of an SD file needs no switch. sed asks the os-on question only for a path: name outside the account's own directory (the last row). The narrower sd-on allows the directories of other SD accounts the person could logto.

The two switches are independent: sh-off leaves OS.EXECUTE alone, and the reverse. A change reaches the account the next time it is entered. SDSYS is never refused, and no other account is an exception — the one the installer makes for whoever installed SD starts off too, and the installer tells them how to turn it on. When you upgrade, the installer switches both on, once, for every account that already exists, so nobody loses a command they were using; you can then turn them off account by account.

Without a switch SD says so in words — "name is not permitted to use the operating system shell", "name is not permitted to use OS.EXECUTE", or "name has no OS access, so outside its own account it can reach by pathname only a directory the administrator opened to all (SDSYS can give it: modify.account name os-on)" — and a program is told with status 3035, so OPEN ... ELSE and DELETESEQ ... ELSE take their ELSE as for any other refusal.

What an account without os-on still has is everything that stays inside SD: every file its VOC names (dictionaries and other SD files included) and anything inside its own directory. A path is judged by its real path, so .. and a symbolic link that points out of the account do not get round it.

A VOC pointer is held to the same rule. A file pointer in an account's VOC must lead inside the account (or be one of the pointers SD itself puts in every VOC), so a pointer written by hand at /etc or at another account's directory is refused, status 3035, unless the account holds os-on. A Q-pointer into another account is followed only if you could logto that account — whether or not you hold os-on. The Administrator set's Accounts and security chapter has the full rule.

One setting of the administrator's opens a directory without os-on. NETDIRS in sd.conf lists directories outside every account that an account without os-on may read and write by pathname, as it may inside its own directory. It is empty as delivered; the Administrator set's Configuration chapter has it.

Four rules hold for all of them:

1. A blank switch means no. A new account has all of them off, and when you upgrade, the installer switches them on once for the accounts that already exist (above).

2. SDSYS passes on its own, regardless of the register, so an empty register cannot lock the machine's own administrator out. This is narrower than the identity check might suggest: it is the sdsys Linux user in a local session, and nothing less passes. A session in any other account gets no exemption at all; it is checked against the account's switches exactly like any other. See Accounts.

3. An API session is checked the same way as any other, by the account it entered — and an SDSYS session, which exists only on this machine's local socket or when the administrator has opened that door, is the administrator's own. An ordinary account with sh-on gets sh over the API exactly as it would anywhere else, which is the real risk sh-on or os-on plus API access creates — see API access. SDSYS reaches the API from another computer only through the door the administrator opens with remote.sdsys api on, shut as delivered.

4. Nothing in SD limits what you then do. Once a switch is on, SD is not standing between that person and the machine — the boundary from that point on is their own Linux user's permissions, and nothing else. An editor can open any file they are allowed to open, in the data tree or outside it. A shell is held to one rule only: at the prompt sh refuses a pipe, a redirect, a chain and a variable, for every account; the way round is a script file.

What the switches do not do. They stop SD handing the operating system to an account that has not been given it. They do not change what the account's Linux user may do — that stays whatever Linux says, checked by the kernel.

When you do turn sh-on or os-on on, you are giving that person a shell on this machine as their own Linux user. An editor can open any file the account may open, in the data tree or outside it. Set the account's Linux permissions deliberately, the way you would for any other user with a shell — and think twice before giving it to an account that is also reachable from outside (ssh, api), because then the shell is behind that account's credential from wherever the route reaches.

So sh-on and os-on are statements of trust in an account. They are not a convenience to be handed out because somebody asked for a full-screen editor. Grant them on the same basis you would grant a shell account on the machine, because that is close to what you are granting.

How to grant and remove them is on Administrator commands.

A session with no terminal is refused for the editors regardless — an API session or a piped script has nowhere to draw a full screen for an editor; see API access for what sh/OS.EXECUTE do over the API, which takes the same switches.

Privileged work is done through a helper, not a raw command line#

When SD creates an account, sets a password or edits a group, it does not build a shell command containing a password or run one as an arbitrary string. sd-elevate, a sudo-scoped helper installed to /usr/local/sbin, is the only thing an SD session can reach with root's help — and it re-derives the legality of each request itself (whose account it is, what the operation actually is) rather than trusting what SD's own session claims.

A credential is never an argument. Where a password has to reach the helper — setting an account's own SD password, for instance — it goes to sd-elevate on stdin, through a file in a private, mode-0700 directory that only the calling session can read, never on a command line where any local user could see it through ps.

If sd-elevate is missing or refuses, SD refuses the privileged work rather than falling back to doing it unprotected. You see the command fail rather than quietly running with less protection than intended.

The audit trail#

/usr/local/sdsys/audit records every login, every refused login, every logto, every refused logto, and every modify.account add/delete, with date, time and the Linux user it belonged to.

2026-10-07 21:07:52 user=sam uid=1 pid=8624 login account=sdsys
2026-10-07 21:07:52 user=sam uid=1 pid=8624 logto refused account=sdsys reason=sdsys is entered by its own session only
2026-10-06 21:03:55 user=sdsys uid=1 pid=4120 delete.account account=ann
2026-10-06 21:04:31 user=sdsys uid=1 pid=4120 remote.api local

Every word before the first = is lower case, the event names included (login, logto, logto refused, api refused, elevation granted, modify.account route api). What follows an = is data and keeps its case: the account name as it is registered, a reason= text, and what a caller typed in command=. A file written by an older version may hold upper case lines, which are not rewritten, so match without regard to case when you search a long-lived file.

An account's gates are on the trail whenever they are given. modify.account writes one line for each word it carries out (modify.account sh-on account=fred; several words in one command give several lines), and create.account records the gates it granted at creation as well:

2026-10-19 15:35:26 user=sdsys uid=1 pid=8326 create.account account=witm1 type=user gates=sh-on,os-on,files-on,files-write-on
2026-10-19 15:35:27 user=sdsys uid=2 pid=8614 create.account account=witm2 type=user gates=none

gates= lists, in lower case, every access the new account was given, always in this order whatever order the words were typed: ssh, api, sh-on, os-on, voc-on, bp-on, dict-on, net-on, files-on, files-write-on, files-admin-on, ai-on, shared-read-off, shared-write-on, pins-on, recovery-on, xfer-on and ssh-key-on (key sign-in over ssh), each only when it was asked for. It says none when there is none. The line is written only after the account has been made: a creation that is refused (an empty password, say) leaves no line.

The refusals are the interesting half. An entry saying somebody who is not SDSYS asked for SDSYS by name, or asked for an account they have not been granted, is the thing worth seeing. Failed API logins are recorded too, with the reason — and before the three-second wait SD adds to slow down guessing, so a program that hangs up during the wait is recorded as well.

This is not the error log and does not behave like it. The error log throws away its oldest half when it fills; the audit file is renamed with the date and time and a new one started when it reaches one megabyte (by the audit daemon as it writes, and by sd -start), so nothing is ever discarded. Removing the old ones is your decision — SD will not do it for you, and they will accumulate.

The file itself is append-only at the kernel level (chattr +a), lifted only by root at the one moment a new file starts, so an SD user cannot remove or edit an entry even with the write permission to add to it — the protection is a Linux filesystem attribute, not merely a permission bit.

SD users can SD users cannot
add to it read it, change a record in it, empty it, rename or delete it

The kernel refuses the edit or the delete, not SD, so a user cannot quietly remove the line that records what they did. SDSYS can read it and do anything else to it as well — a real login as sdsys can lift the append-only attribute, the same as any root-equivalent action, so this raises the floor against ordinary users rather than trying to constrain the machine's own administrator.

What is still not true#

SD accounts are not isolated from each other's data at the file level beyond whatever this machine's own Linux permissions provide. Everyone who uses SD needs file access to the tree, because their own process does the I/O. Anyone deploying SD for ten people over ssh should be told that plainly — see Security.

SD's own access control to operating-system files is the account's os-on switch, and it is the only one. While the switch is off, as delivered, SD holds every session of the account — at the console, over ssh and over the API alike — to the account's own directory when it opens an operating-system file by pathname (plus any directory the administrator listed in NETDIRS); an account that holds os-on is held only by Linux's permissions on its user. What the session may do inside the files SD itself opens is whatever Linux lets its user do — see API access.