Hi Paul, hi Chris,
Paul de Weerd wrote on Sat, Sep 29, 2007 at 10:01:28PM +0200:
On Fri, Sep 28, 2007 at 09:48:08PM -0400, Chris Nolan wrote:
Hello, I read through the FAQ and searched the archives but couldn't
find an answer to this question. In /src/distrib/sets/lists/etc/mi,
why does openbsd include the .cshrc and .profile files in the root
directory?
If you log in but you're homedir is unavailable (not mounted (nfs ?))
you'll get logged in with CWD in /. You'll then also get the /.profile
or the /.cshrc as appropriate to your shell.
That's what i might have suspected, too, but it does not appear to be
true. When your home directory is unavailable, your $PWD will indeed
be / after logging in, but your $HOME is still what is defined in
the passwd(5) file, and /.profile does not appear to be sourced.
Look here:
[EMAIL PROTECTED] # echo 'export TESTVAR=testvalue' /.profile
[EMAIL PROTECTED] # ls -al /.profile /etc/profile
ls: /etc/profile: No such file or directory
-rw-r--r-- 1 root wheel 27 Sep 29 22:50 /.profile
[EMAIL PROTECTED] # umount /home
[EMAIL PROTECTED] # ls -a /home
. ..
[EMAIL PROTECTED] $ ssh athene
[EMAIL PROTECTED]'s password:
OpenBSD 4.2-current (GENERIC) #60: Wed Sep 26 20:43:39 CEST 2007
Could not chdir to home directory /home/schwarze: No such file or directory
$ echo $SHELL
/bin/sh
$ echo $HOME
/home/schwarze
$ pwd
/
$ echo TESTVAR = '$TESTVAR'
TESTVAR = ''
This behaviour conforms to sh(1) and ksh(1):
:: -l Login shell. If the basename the shell is called with (i.e.
::argv[0]) starts with `-' or if this option is used, the shell is
::assumed to be a login shell and the shell reads and executes the
::contents of /etc/profile and $HOME/.profile if they exist and are
::readable.
Nothing about $PWD/.profile round here...
For csh(1), things look similar.
See login(1), ssh(1) and /usr/src/usr.bin/ssh/session.c to learn how
login and ssh are setting $HOME.
Yours,
Ingo