Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

users.conf can't work multiple users Wrong password #28

Open
100730088 opened this issue Dec 27, 2024 · 18 comments
Open

users.conf can't work multiple users Wrong password #28

100730088 opened this issue Dec 27, 2024 · 18 comments

Comments

@100730088
Copy link

like:

#username:UID:groupname:GID:password
# Admin:1000
#samba:1000:smb:1000:secret
Admin:1000:Admin:1000:Samba
## Other: 1700
Temp:1701:Other:1700:temp

Use Admin Samba to log in, prompting that the password is incorrect.

I used it Change the password to 123, can log in.

docker compose exec -it samba bash
pdbedit -a -u Admin
@kroese
Copy link
Contributor

kroese commented Dec 27, 2024

@HanLiQL

@tanghulu0608
Copy link

I have the same issue

@HanLiQL
Copy link
Contributor

HanLiQL commented Dec 27, 2024

Try adding a newline at the end of the users.conf file. If this resolves the issue, feel free to reach out to me again.

@HanLiQL
Copy link
Contributor

HanLiQL commented Dec 27, 2024

You can delete and recreate the container, then share the detailed logs with me again.

在users.conf的最后一行加个回车,再删除容器重新创建容器试试,还有问题的话,发我个log看看吧。

@KintonHiryuu
Copy link

KintonHiryuu commented Jan 12, 2025

Same issue here, when my users.conf don't break all samba, it just won't allow me to log in "wrong password"
i tried recreating the container, repulling the image, and so on, the only time it works is when i go in the terminal and smbpasswd -a <user> manually, after doing it i can connect directly

#username:UID:groupname:GID:password
samba:1000:samba:1001:Samba
test:1005:test:1005:temp

logs :

Using provided configuration file: /etc/samba/smb.conf.
Group test does not exist, creating group...
User test does not exist, creating user...
User test has been added to Samba and password set.
smbd version 4.20.6 started.
Copyright Andrew Tridgell and the Samba Team 1992-2024

@HanLiQL
Copy link
Contributor

HanLiQL commented Jan 13, 2025

@KintonHiryuu
Did you add a newline at the end of the last line in users.conf? If not, try adding one and test again. Make sure to destroy the container and recreate it, instead of just restarting it. I encountered this issue too, but I’m not sure how to resolve it yet. Could you check if this is the same problem on your side? It might be related to the missing newline at the end of the file.

@HanLiQL
Copy link
Contributor

HanLiQL commented Jan 13, 2025

#31
@kroese

@KintonHiryuu
Copy link

@KintonHiryuu
Did you add a newline at the end of the last line in users.conf? If not, try adding one and test again. Make sure to destroy the container and recreate it, instead of just restarting it. I encountered this issue too, but I’m not sure how to resolve it yet. Could you check if this is the same problem on your side? It might be related to the missing newline at the end of the file.

I did all my test with the new line at the end as you stated in your first reply, if i wasn't doing it, the last user wasn't taken any way so i had no choice.
The vast majority of the time i tested i destroyed the container and rebuilt, even repulling the image 2-3 times to make sure i didnt mess up the thing as I'm kinda new to docker

@HanLiQL
Copy link
Contributor

HanLiQL commented Jan 13, 2025

I did all my test with the new line at the end as you stated in your first reply, if i wasn't doing it, the last user wasn't taken any way so i had no choice. The vast majority of the time i tested i destroyed the container and rebuilt, even repulling the image 2-3 times to make sure i didnt mess up the thing as I'm kinda new to docker

Does this setting samba:1000:samba:1001:Samba work? Can you log in using samba:Samba?

Also, how did you destroy the container and rebuild it?

@KintonHiryuu
Copy link

KintonHiryuu commented Jan 13, 2025

iirc samba:1000:samba:1001:Samba didnt work, but I'll setup a test server after some sleep for this (utc+2, it's 5am here) so i can be sure

And for how did i rebuild the container, I'm using portainer since like i said I'm quite new and it's convenient to simply click the rebuilt button it gives me, i don't know how exactly porting handle it, but i can assure it deletes the whole container and make a new one like it's never been installed

I'll not install it and do it manually on the test server, just to be 100% sure

@KintonHiryuu
Copy link

I did all my test with the new line at the end as you stated in your first reply, if i wasn't doing it, the last user wasn't taken any way so i had no choice. The vast majority of the time i tested i destroyed the container and rebuilt, even repulling the image 2-3 times to make sure i didnt mess up the thing as I'm kinda new to docker

Does this setting samba:1000:samba:1001:Samba work? Can you log in using samba:Samba?

Also, how did you destroy the container and rebuild it?

ok, test done, with rebuilding each times (deleting and recreating the container with the same env & volumes)
when users.conf contains only samba:1000:samba:1001:Samba without newline nor anything, it works

when users.conf contains samba:1000:samba:1001:Samba with newline, it does not and logs says nothing (i don't know if there's a verbose parameter ? i don't think i saw one)

Using provided configuration file: /etc/samba/smb.conf.
Group samba does not exist, creating group...
User samba does not exist, creating user...
User samba has been added to Samba and password set.
smbd version 4.20.6 started.
Copyright Andrew Tridgell and the Samba Team 1992-2024

when users.conf contains 2 users >

samba:1000:samba:1001:Samba
user:1002:user:1003:user || with new line

it create user/group samba, create group user, and user user even if it doesnt log it (id -u user gave me 1002), but no users can log in

When removing the new line, same as above but i was able to login with user, but not with samba
logs for both >

Using provided configuration file: /etc/samba/smb.conf.
Group samba does not exist, creating group...
User samba does not exist, creating user...
User samba has been added to Samba and password set.
Group user does not exist, creating group...
smbd version 4.20.6 started.
Copyright Andrew Tridgell and the Samba Team 1992-2024

Since i was at it, i tested with ; at the end of lines just in case, both user and samba are broken with it, same logs as above

Added a third user, john:1004:john:1005:doe
Without new line, only him can login, with new line, neither of them can

Using provided configuration file: /etc/samba/smb.conf.
Group samba does not exist, creating group...
User samba does not exist, creating user...
User samba has been added to Samba and password set.
Group user does not exist, creating group...
Group john does not exist, creating group...
User john does not exist, creating user...
User john has been added to Samba and password set.
smbd version 4.20.6 started.
Copyright Andrew Tridgell and the Samba Team 1992-2024

i'm also starting to suspect windows of doing wierd.....things, but i can't explain any of them i'm not familiar with samba a/o windows caching enough to be sure what's going on

hope it can somehow be usefull ? if you need more just ask i'll stay looking around

@HanLiQL
Copy link
Contributor

HanLiQL commented Jan 13, 2025

@KintonHiryuu
Thank you very much for your cooperation in testing. I am also testing with Portainer, and it feels a bit strange. I have been using Portainer for a while, but I have never used it to create or recreate images. All my image creation has been done through Docker Compose. I’ll try again. I also need to sleep now. If there's anything I need you to do, I will contact you again. Thanks!

@HanLiQL
Copy link
Contributor

HanLiQL commented Jan 14, 2025

@KintonHiryuu
Could you share your users.conf and smb.conf files with me for testing? Please upload them as attachments in the comments. You can create different folders with different users.conf and smb.conf files so that I can run multiple tests for you. Compress these folders into a single archive and upload it.

@100730088
Copy link
Author

pack.zip

You can delete and recreate the container, then share the detailed logs with me again.

在users.conf的最后一行加个回车,再删除容器重新创建容器试试,还有问题的话,发我个log看看吧。

I did it, but the problem remains
我照做了,但是问题依旧

@HanLiQL
Copy link
Contributor

HanLiQL commented Jan 17, 2025

pack.zip

You can delete and recreate the container, then share the detailed logs with me again.

在users.conf的最后一行加个回车,再删除容器重新创建容器试试,还有问题的话,发我个log看看吧。

I did it, but the problem remains 我照做了,但是问题依旧

The users.conf file in the compressed archive you provided does not contain the users 'WinPVE' and 'QNAP', but they are present in your log. Is there any hidden information, or what’s going on?

@HanLiQL
Copy link
Contributor

HanLiQL commented Jan 20, 2025

I finally found the root cause of this issue:

1.smb.conf and users.conf should be LF files, but if they are CRLF files, the previous bash script would treat the \r before the \n at the end of the line as part of the password. I have added logic to remove the \r character in the latest code, and it is now working properly. However, it is still recommended to use the LF format.

2.Some users have users.conf files that don't have a newline or a blank line at the end, causing the last line's configuration to be unrecognized. This issue was fixed in the last commit, and now all content can be correctly recognized.

Many thanks to @100730088 @tanghulu0608 @KintonHiryuu for conducting the tests and pinpointing the issue, which ultimately led to the successful resolution of the problem.
Thanks to the author @kroese for their work and for creating this Docker.

@HanLiQL
Copy link
Contributor

HanLiQL commented Jan 20, 2025

@KintonHiryuu try the newest docker.

@KintonHiryuu
Copy link

@KintonHiryuu try the newest docker.

Can't wait to, but I'm on trip so I'll do on next week, thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants