Bug 4007 - smbpasswd doesn't prompt root for password
Summary: smbpasswd doesn't prompt root for password
Status: RESOLVED INVALID
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Config Files (show other bugs)
Version: 3.0.23a
Hardware: Other Linux
: P3 normal
Target Milestone: none
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-07 16:47 UTC by Alexander Skwar (mail address broken)
Modified: 2019-06-11 21:24 UTC (History)
1 user (show)

See Also:


Attachments
config.log (141.19 KB, text/plain)
2006-08-07 16:48 UTC, Alexander Skwar (mail address broken)
no flags Details
"strace" output of smbpasswd (23.69 KB, text/plain)
2006-08-16 13:54 UTC, Alexander Skwar (mail address broken)
no flags Details
/etc/samba/smbpasswd (106 bytes, text/plain)
2006-08-16 13:55 UTC, Alexander Skwar (mail address broken)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Skwar (mail address broken) 2006-08-07 16:47:47 UTC
When I run smbpasswd from samba 3.0.23a on a MIPSEL system running
Linux 2.4.20 as root, I'm NEVER asked for a password. Even when I
create a new user in smbpasswd, I'm not asked:

root@HD.bei.digitalprojects.com:/etc/samba# strings smbpasswd
root:0:AAD3B435B51404EEAAD3B435B51404EE:31D6CFE0D16AE931B73C59D7E0C089C0:[U          ]:LCT-44D63D42:
bin:1:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[DU         ]:LCT-00000000:
daemon:2:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[DU         ]:LCT-00000000:
adm:3:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[DU         ]:LCT-00000000:
sync:5:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[DU         ]:LCT-00000000:
nobody:99:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[DU         ]:LCT-00000000:
root@HD.bei.digitalprojects.com:/etc/samba# smbpasswd -a askwar
Added user askwar.
root@HD.bei.digitalprojects.com:/etc/samba# smbpasswd askwar
root@HD.bei.digitalprojects.com:/etc/samba# strings smbpasswd
root:0:AAD3B435B51404EEAAD3B435B51404EE:31D6CFE0D16AE931B73C59D7E0C089C0:[U          ]:LCT-44D63D42:
bin:1:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[DU         ]:LCT-00000000:
daemon:2:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[DU         ]:LCT-00000000:
adm:3:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[DU         ]:LCT-00000000:
sync:5:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[DU         ]:LCT-00000000:
nobody:99:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[DU         ]:LCT-00000000:
askwar:1000:AAD3B435B51404EEAAD3B435B51404EE:31D6CFE0D16AE931B73C59D7E0C089C0:[U          ]:LCT-44D63EAE:

When I run smbpasswd as a user, eg. as Unix user "askwar", I AM prompted
for a password.

askwar@HD.bei.digitalprojects.com:~/src/samba-3.0.23a/source$ smbpasswd
Old SMB password:

But as I don't know the "Old SMB password", I'm somewhat at a loss... :)

I also cannot feed the password over stdin as root:

root@HD.bei.digitalprojects.com:/etc/samba# echo foo | smbpasswd -s askwar
Mismatch - password unchanged.
Unable to get new password.

What's happening here?


I'll attach the config.log to the report.
Comment 1 Alexander Skwar (mail address broken) 2006-08-07 16:48:15 UTC
Created attachment 2087 [details]
config.log
Comment 2 Alexander Skwar (mail address broken) 2006-08-16 13:23:17 UTC
Problem still exists with 3.0.23b.
Comment 3 Alexander Skwar (mail address broken) 2006-08-16 13:54:25 UTC
Created attachment 2092 [details]
"strace" output of smbpasswd

I don't know if it helps or not, but attached you can find the strace output of 

         smbpasswd askwar

I'll also attach /etc/samba/smbpasswd.
Comment 4 Alexander Skwar (mail address broken) 2006-08-16 13:55:19 UTC
Created attachment 2093 [details]
/etc/samba/smbpasswd

/etc/samba/smbpasswd from the samba system. It only contains one entry for the "askwar" user. I don't know the password :|
Comment 5 Alexander Skwar (mail address broken) 2006-08-17 15:04:56 UTC
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@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.
Comment 6 t12nslookup 2011-07-08 13:17:08 UTC
Umm ...

This is the way that "smbpasswd" is supposed to work ... the way it was designed to work in fact.
Comment 7 Andrew Bartlett 2019-06-11 21:07:59 UTC
(In reply to t12nslookup from comment #6)
Correct, this is by design.  See -r to force a remote change.