Zsh Mailing List Archive
Messages sorted by:
Re: Change directory on invocation of zsh
- X-seq: zsh-users 8064
- From: Michael Prokop <news@xxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Change directory on invocation of zsh
- Date: Sun, 17 Oct 2004 20:55:20 +0200
- In-reply-to: <Pine.LNX.4.61.0410170908590.8058@xxxxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <2004-10-16T23-18-26@xxxxxxxxxxxxxxxxxxxxxxxxx> <Pine.LNX.4.61.0410161942220.8058@xxxxxxxxxxxxxxxxxx> <2004-10-17T16-22-44@xxxxxxxxxxxxxxxxxxxxxxxxx> <Pine.LNX.4.61.0410170908590.8058@xxxxxxxxxxxxxxxxxx>
- Reply-to: Michael Prokop <zsh@xxxxxxxxxxxxxxxxx>
* Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> [20041017 18:28]:
> On Sun, 17 Oct 2004, Michael Prokop wrote:
> > * Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> [20041017 10:13]:
> > > if (( EUID == 0 )); then
> > > export HOME=/root
> > > else
> > > export HOME=/home/$LOGNAME
> > > fi
> > /etc/zsh/zshrc:cd:22: no such file or directory: /home/LOGIN
> > $ echo $LOGNAME
> > LOGIN
> Hm. This means that one of the following occurred:
> - getlogin() returned "LOGIN"
> - getlogin() returned empty or null, and getpwuid() returned an entry for
> the user named "LOGIN"
[.../rungetty-1.2]$ grep LOGIN rungetty.c
#define _PATH_LOGIN "/bin/login"
#define LOGIN " login: " /* login prompt */
strncpy (ut.ut_user, "LOGIN", sizeof (ut.ut_user));
ut.ut_type = LOGIN_PROCESS;
write (1, LOGIN, sizeof (LOGIN) - 1);
execl (_PATH_LOGIN, _PATH_LOGIN, "-f", autologin_name, NULL);
execl (_PATH_LOGIN, _PATH_LOGIN, "--", logname, NULL);
error ("%s: can't exec " _PATH_LOGIN ": %s", tty, sys_errlist[errno]);
> I'd have to guess this is a side-effect of autologin? Does it run as the
> user "LOGIN"?
This seems to be a side-effect of rungetty's autologin, yes.
rungetty should run as user root or as the user specified in
/etc/inittab, in my case this is user 'grml':
4:2345:respawn:/sbin/rungetty tty4 -u grml -g grml --autologin grml /bin/zsh
I'm in contact with the debian maintainer of the rungetty-package.
> > I can't find the reason for this behaviour (inittab entries are the
> > same and behaviour seems to change when booting system serveral
> > times), but using `id -un` instead of $LOGNAME seems to fix it.
> If you can't figure out how to get it to be consistent, I'd suggest adding
> to /etc/zsh/zshenv this snippet:
> [[ $LOGNAME == LOGIN ]] && LOGNAME=$(id -un)
> Do that before the EUID/HOME snippet. Other things may be depending on
> LOGNAME being set correctly, too.
Thanks, works like a charme!
Messages sorted by: