[Samba] Re: smbpasswd doesn't prompt root for password

Alexander Skwar listen at alexander.skwar.name
Thu Aug 17 20:05:41 GMT 2006

Alexander Skwar schrieb:
> · Gerald (Jerry) Carter <jerry at samba.org>:
>> Please file a bug an attach the gzipped config.log from your build.
> https://bugzilla.samba.org/show_bug.cgi?id=4007

I did some debugging and found, that get_pass() in utils/passwd_util.c
gets executed. There, the "else" branch gets run, ie. "p = getpass( prompt);"
is run. This is just a #define for getsmbpass() which resides in
lib/getsmbpass.c. And in getsmbpass(), the execution differs for root
and non-root users.

When I'm root, the *ELSE* branch of the "if (in == NULL)" (the first if
in that function) is run. This means, that

	in = fopen ("/dev/tty", "w+");

did NOT return NULL.

Next, the test "if (tcgetattr (fileno (in), &t) == 0) {" yields FALSE for
root - for non-root, this test is TRUE.

Why does this happen? Does this mean, that root, for some reason, cannot
open /dev/tty for writing?

root at HD:/etc/samba# ls -al /dev/tty*
-rw-r--r--  1 root root    25 Aug 17 21:54 /dev/tty
crw-rw-rw-  1 root root 4, 64 Aug 17 22:00 /dev/ttyS0

I'm logged in to this system over a SSH session. The SSH server is
Dropbear sshd v0.46.

I don't understand this.

Can somebody make sense of this?


Alexander Skwar
Punning is the worst vice, and there's no vice versa.

More information about the samba mailing list