On Wednesday 07 November 2007 09:50, Rajeev Bansal wrote:
> Hi All,
> 
> I am using the busybox in my root file system, everything is fine with 

Which version of busybox do you use?

> that, except when I try to login as a root from serial console it 
> doesn't prompt me for the password and immediately say "Login 
> Incorrect".

Do non-root logins work? Does it work if you configure
busybox without CONFIG_FEATURE_SECURETTY=y?

> I need to login as a root from  serial console, so can  
> anyone tell me how I can make it happen. I have a /etc/securetty file 
> present and I have added the entry for ttyS0 in that.

Sounds like you did everything right.

> I think login  
> utility of busybox doesn't read the securetty file.

It reads /etc/securetty here:

#if ENABLE_FEATURE_SECURETTY && !ENABLE_PAM
static int check_securetty(void)
{
        FILE *fp;
        int i;
        char buf[256];

        fp = fopen("/etc/securetty", "r");
        if (!fp) {
                /* A missing securetty file is not an error. */
                return 1;
        }
        while (fgets(buf, sizeof(buf)-1, fp)) {
                for (i = strlen(buf)-1; i >= 0; --i) {
                        if (!isspace(buf[i]))
                                break;
                }
                buf[++i] = '\0';
                if (!buf[0] || (buf[0] == '#'))
                        continue;
                if (strcmp(buf, short_tty) == 0) {
                        fclose(fp);
                        return 1;
                }
        }
        fclose(fp);
        return 0;
}
#else


and checks here:

                pw = getpwnam(username);
                if (!pw) {
                        strcpy(username, "UNKNOWN");
                        goto fake_it;
                }

                if (pw->pw_passwd[0] == '!' || pw->pw_passwd[0] == '*')
                        goto auth_failed;

                if (opt & LOGIN_OPT_f)
                        break; /* -f USER: success without asking passwd */

                if (pw->pw_uid == 0 && !check_securetty())  <==== HERE
                        goto auth_failed;

--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to