From the first boot to a system with your own account, packages and an ssh key. Each step is a few commands.
ne2k_isa) for barn.Boot the floppy (download). In QEMU, with an empty hard disk image for step 3 already attached:
qemu-img create -f raw mnix-disk.img 1G qemu-system-x86_64 -m 256 -vga std \ -drive file=mnix-x86_64.img,format=raw,if=floppy \ -drive file=mnix-disk.img,format=raw,if=ide,index=0 -boot a \ -netdev user,id=net0 -device ne2k_isa,netdev=net0,iobase=0x300,irq=9
The kernel asks two kinds of questions, in its own text mode:
y.Then the login prompt: type root. On the floppy there is no
password, because a read-only floppy has nowhere to keep one; whoever
boots the floppy owns the machine anyway.
mnix login: root Read-only system (no disk): root has no password here. root@mnix:~#
root@mnix:~# mnix-install
It lists the disks, asks which one, and wants yes before
it erases anything. It writes an 8 MB boot partition (loader, kernel,
your sealed driver approvals) and an ext2 partition for /,
and asks whether to keep your passphrase and approvals (say yes). The
first time it also asks you to approve the disk driver.
Then boot from the disk: poweroff, and start QEMU again
without the floppy, with -boot c (on a real PC, take the
floppy out).
Type your passphrase, log in as root, and MNIX asks for
what the floppy could not keep:
mnix login: root This system has no root password yet. Choose one now: it protects everything that needs root (sudo, su, drivers, /etc). New password: Retype new password: Root has a password now. Create an account for yourself? Name (Enter to skip): alice Password for alice: New password: Retype new password: User alice (uid 1000) created, home /home/alice. alice may use sudo (group wheel).
Log out with exit and log in as yourself. Use root only
through sudo from now on.
The prompt ends in $ for you and # for root.
Only root may change /etc, load or stop drivers, talk to
drivers directly, install packages, bind ports below 1024 and reboot.
Everybody may look: drv, ps, net,
ls -l.
| Command | What |
|---|---|
id, whoami, groups | who you are |
sudo CMD ... | run CMD as root, with your own password (members of wheel) |
sudo -i | a root shell |
su [-] [USER] | become another user, with their password |
passwd | change your password |
sudo adduser [--admin] NAME | a new user with a home in /home; --admin: may use sudo |
sudo adduser NAME wheel | give an existing user sudo (at the next login) |
sudo deluser [--remove-home] NAME | remove a user |
chmod, chown, chgrp | modes and owners |
sudo also runs the shell's own commands, so
sudo drv load /drv/rtc.drv and sudo mode 1024x768x32
work as they read. The accounts are the usual Unix files,
/etc/passwd, /etc/group and /etc/shadow
(readable by root only), so Linux programs find you the usual way.
The network comes up by itself (DHCP). net shows the
address. Packages come from barn, over HTTPS from
this site:
alice@mnix:~$ sudo barn update alice@mnix:~$ sudo barn install busybox edit git alice@mnix:~$ barn list
BusyBox brings ash (a full shell with pipes and
&&), vi, grep,
tar and the rest; edit is a small editor with
nano's keys.
/etc/init.conf says what starts at boot: drivers, the
disk, the network, the login. To change it:
alice@mnix:~$ sudo edit /etc/init.conf
The shipped file comes from the boot area; the first save puts a copy on the disk, and from then on init reads that one once the disk is mounted. Keep the shipped lines and add yours, for example a driver from the disk:
driver /usr/lib/drv/mycard.drv service /usr/bin/myserver --port 8080
At the next boot the kernel asks you to approve the new driver, at its
own prompt, like the first ones. init only uses the file while root owns
it and nobody else may write it or /etc; otherwise it says
ignoring /etc/init.conf on the disk and boots with the
shipped one.
alice@mnix:~$ sudo barn install git # brings openssh along alice@mnix:~$ ssh-keygen -t ed25519 alice@mnix:~$ cat ~/.ssh/id_ed25519.pub
Give the public key to GitHub (Settings, SSH and GPG keys) or put it
into ~/.ssh/authorized_keys on another machine. Your private
key stays in ~/.ssh, readable by you only; ssh refuses keys
that others could read, and MNIX's permissions make sure they cannot.
alice@mnix:~$ ssh -T git@github.com alice@mnix:~$ git config --global user.name "Alice" alice@mnix:~$ git config --global user.email alice@example.org alice@mnix:~$ git clone git@github.com:alice/project.git alice@mnix:~$ git clone https://github.com/octocat/Hello-World.git
scp, sftp and ssh-keyscan come with it. Not there yet: ssh-agent and logging into MNIX over ssh.
drv shows how often.sudo in front.adduser YOU wheel,
then log in again.wheel can
set a new one: sudo passwd root. If nobody can, the ext2
partition opens in Linux too: empty root's field in
/etc/shadow and the next login asks for a new one./etc/init.conf
(service /sbin/netd dhcp dns=1.1.1.1), or use git over
ssh.More detail is in the documentation that comes with the source: docs/users.md, docs/packages.md, docs/installation.md.