AW: Cannot log in as root directly, but su works
Martetschlaeger Stefan
Martetschlaeger.Stefan at fronius.com
Mon Mar 12 09:46:40 PDT 2007
Hi all,
I've finally solved the problem.
It's been a problem with the securetty checks in login, because login assumes that
the ttyxx is in the /dev/ directory. In fact the tty device was (due to /dev beeing
a symlink) in /mnt/ramdisk0/dev/ttyS0 which didn't resolve to ttyS0 in the login
applet and thus not allowing root to login.
The fix would be to either change all entries in securetty to the mnt/ramdisk...
directory or change the behaviour of login to assume that the tty devicefile is
beeing held in /dev.
I've attached a patch for the latter case :)
Cheers,
Steve
diff -uNr tmp/busybox-1.4.1/loginutils/login.c busybox-1.4.1/loginutils/login.c
--- tmp/busybox-1.4.1/loginutils/login.c 2007-01-24 22:34:48.000000000 +0100
+++ busybox-1.4.1/loginutils/login.c 2007-03-12 17:23:22.000000000 +0100
@@ -250,8 +250,8 @@
tmp = ttyname(0);
if (tmp) {
safe_strncpy(full_tty, tmp, sizeof(full_tty));
- if (strncmp(full_tty, "/dev/", 5) == 0)
- short_tty = full_tty + 5;
+ if (strstr(full_tty, "/dev/") != NULL)
+ short_tty = strstr(full_tty, "/dev/") + 5;
}
read_or_build_utent(!amroot);
More information about the busybox
mailing list