Re: Conditional SymLinks

Albert D. Cahalan (acahalan@cs.uml.edu)
Thu, 18 Dec 1997 18:41:40 -0500 (EST)


Steve Baker writes:

> You can at least do:
>
> /tmp -> /proc/self/env/HOME/tmp
>
> and expect it to work reasonably well, except in the cases where HOME
> isn't defined, points to /, etc...
>
> I guess the only real way to do it would be the way my first proof of
> concept worked, but cleaned up and expanded upon I suppose. It also means
> that conditional sym-links haven't got a chance of getting in the kernel.

The problem is that you used the normal process environment.
You could use kernel variables and the init environment.

The whole dentry system was originally created to support this,
so something will get in the kernel. The original intent was
to have an NFS server share the root partition with clients.
That means /etc is the same, which is troublesome.

To redirect /tmp to home directories, I suggest we add
the setlogin(2) system call like Digital Unix.

int setlogin(char *name);

setlogin(2) is restricted to root. It is called at login time.
getlogin(2) is a system call too, so it can't be fooled.
The login name is inherited by children. It does not change
even when the UID changes, so "su" won't cause trouble.

This would be the perfect opportunity to add per-user limits.
The actual system call could take more parameters than the
plain setlogin() call. This allows /proc/utmp too.