LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-28-2009, 04:09 PM   #1
ngiamol
Member
 
Registered: Apr 2009
Location: Athens - Hellas (greece)
Distribution: Centos
Posts: 36

Rep: Reputation: 16
Samba problem in local lan


Good evening to everyone.

On my linuxbox i have installed mandriva pwp 2009 and running samba.
suddenly the shared folders stoped working and ive found out that my smbpasswd db is corrupted (build_sam_account: smbpasswd database is corrupt! username xxxx with uid 504 is not in unix passwd database!)

i tried to create a new user with the same uid but the result was the same.

for a week now im reading various posts on net with similar problems but unfortunately i have no results.

Is there any way to repair the errors in smbpasswd database?

except that, is there any way to find out the "original" uid's and gid's of linux? (like adm, smbguest, e.t.c.)

can anyone give me an advice?

Thanks in advance
Nick.
 
Old 04-29-2009, 05:10 AM   #2
fotoguy
Senior Member
 
Registered: Mar 2003
Location: Brisbane Queensland Australia
Distribution: Custom Debian Live ISO's
Posts: 1,291

Rep: Reputation: 62
I think the sambapasswd is just a text file, should be able to delete it and then create a new one, then add you user to it.

Quote:
except that, is there any way to find out the "original" uid's and gid's of linux? (like adm, smbguest, e.t.c.)
Chekout the /etc/group /etc/passwd files, these will have uid and gid's in them.
 
Old 04-29-2009, 05:22 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Run "grep 504 /etc/passwd /etc/samba/passwd" and see who has that UID. If you installed a fresh distro, maybe the UIDs are different on that host and don't match what is in the /etc/samba/smbpasswd database.

You can delete an entry in the smbpasswd file with "sudo smbpasswd -x <username>" or manually delete the line in /etc/samba/smbpasswd and than re-add it. The smbpasswd command is used to add/remove users & change passwords in the /etc/samba/smbpasswd file.
 
Old 04-29-2009, 05:27 AM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
You may also find it useful to try the pdbedit command (see man pdbedit).

I'd start with "pdbedit -L" and see if that throws up any errors.
 
Old 04-29-2009, 05:31 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
pdbedit is for when you use the SAM database. His error message indicates that the /etc/samba/smbpasswd file is used instead.
 
Old 04-29-2009, 05:39 AM   #6
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Fair point
 
Old 04-29-2009, 07:55 AM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
If the smbpasswd file is actually /etc/samba/passdb.tdb, you can use tdbdump to get a text version.
HTH
 
Old 04-29-2009, 08:41 AM   #8
ngiamol
Member
 
Registered: Apr 2009
Location: Athens - Hellas (greece)
Distribution: Centos
Posts: 36

Original Poster
Rep: Reputation: 16
I used the command pdbedit -i smbpasswd -e and i got no errors.

i created a new user with the name newbie. I changed the password of that user and i used the 123456 (only to see if is working) and i imported the users in samba (via webmin) then i got this error.

Failed to convert user : /usr/bin/pdbedit failed : add_smbfilepwd_entry: entry with name xxx already exists

For any case, i have an order copy of users i use in samba. If i delete the file which stores the users and the password db,
is it possible to fix the error?
 
Old 04-29-2009, 08:42 AM   #9
ngiamol
Member
 
Registered: Apr 2009
Location: Athens - Hellas (greece)
Distribution: Centos
Posts: 36

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by chrism01 View Post
If the smbpasswd file is actually /etc/samba/passdb.tdb, you can use tdbdump to get a text version.
HTH
I took it from webmin

Full path to smbpasswd: /usr/bin/smbpasswd
The only .tdb file i can see in /etc/samba is the secrets.tdb (i hope it helps)

Last edited by ngiamol; 04-29-2009 at 08:46 AM.
 
Old 04-29-2009, 09:09 AM   #10
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I think that I misread your first message. Could you post the General part of your smb.conf file. Determining whether you are using smbpasswd or SAM would be a start.

I think that you were using a migration tool to go from using smbpasswd to using the SAM database. I don't know why you were doing that or which database type you are using.

Is the new Mandriva install on the server or the client?
Mandrive starts new user IDs at 500. SuSE starts them at 1000. Do you have a user with the same username but different UID?
I'm not certain if that would be a problem (due to cifs support).

Also what do you have for the line "Security ="? Is it "Security = User"?
 
Old 04-29-2009, 09:20 AM   #11
ngiamol
Member
 
Registered: Apr 2009
Location: Athens - Hellas (greece)
Distribution: Centos
Posts: 36

Original Poster
Rep: Reputation: 16
The mandriva is a clean install on server, and the lowest uid is the 500 (for users).
At first time i tried to have different gid for users due to quota.
Every time i created a user (when everything was working well) i used the group "users" in samba and enabled a quota for users (10Gb each). Suddenly i discovered that the whole group "users" shared 10Gb of space instead of every user in group.

I managed to solve this problem for a few users by doing the following.
I removed the user from "users" group and i created a new group same as the username and i enabled quota for that user. When suddenly stoped working (bleh, the newbie life is never an easy thing)

here is my smb.conf
Here we are,

[global]
log file = /var/log/samba/samba.log
obey pam restrictions = yes
preserve case = yes
short preserve case = yes
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
username level = 6
hostname lookups = yes
follow symlinks = no
interfaces = 127.0.0.1/8 192.168.0.0/24
domain master = no
encrypt passwords = yes
hosts allow = 127. 192.168.0/24
name resolve order = wins host bcast
client plaintext auth = no
password level = 6
netbios name = Samba
cups options = raw
wide links = no
server string = Samba file and print server
workgroup = Workgroup
os level = 33
printcap name = cups
security = user
bind interfaces only = yes
max log size = 50
winbind cache time = 360
pam password change = yes
winbind rpc only = yes

[homes]
map archive = no
browseable = no
locking = no
writable = yes
preserve case = no
path = /home
comment = Home Directories
valid users = %U
share modes = no
short preserve case = no
case sensitive =

[printers]
comment = All Printers
path = /var/spool/samba
printable = yes
share modes = no
locking = no

[pdf-documents]
path = /home/pdf-documents
comment = Converted PDF Documents
read only = no
guest ok = yes

[pdf-printer]
path = /tmp
comment = PDF Printer Service
printable = yes
guest ok = yes
use client driver = yes
printing = bsd
print command = /usr/bin/gadmin-samba-pdf %s %u

[Downloads]
path = /home/public/
comment = No comment
create mode = 777
read only = no
available = yes
browseable = yes
writable = yes
guest ok = yes
public = yes
printable = no
share modes = no
locking = no

Last edited by ngiamol; 04-29-2009 at 09:28 AM.
 
Old 05-01-2009, 12:59 AM   #12
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I hadn't noticed the "share modes" before. From the manpage:
You should NEVER turn this parameter off as many Windows applications will break if you do so.

Default: share modes = yes

I thought I would attach the smb.conf file for my laptop, as the services are similar.

I use NFS predominately and have the same UID on all Linux machines, including another laptop with Fedora which normally starts UIDs at 500 instead of 1000.

I'm not certain if mounting with the type cifs would cause a problem if the UIDs of a user was different on two computers. Mounting a share with the cifs type allows using even using setfacl.
Attached Files
File Type: txt smb.conf.txt (1.5 KB, 46 views)
 
Old 05-04-2009, 04:27 AM   #13
ngiamol
Member
 
Registered: Apr 2009
Location: Athens - Hellas (greece)
Distribution: Centos
Posts: 36

Original Poster
Rep: Reputation: 16
Sorry for the late respond but during the weekend i did various tests.

For every error i got in smbpasswd, i created a user with same uid till all errors stoped
Via webmin in user creation, i told to the system to increase the uid/gid for every new user from 500 to 600 and i started adding users/groups.

Right after restart of samba, the new users was able to use their personal files

(i have some minor broblems left but is another case).


I would like to thank everyone for your valuable help

Regards
Nick.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange problem with local permissions on WinXP using a Samba PDC with LDAP backend qtac Linux - Networking 2 09-08-2009 11:33 PM
problem with lan and samba slowdown when internet is down muxman Linux - Networking 1 11-07-2007 02:54 PM
Samba local network problem lymantc Linux - Server 2 07-30-2007 11:53 AM
Setup local machine to allow lan machines to retrieve its local user mail. Brian1 Linux - Networking 3 03-30-2006 05:04 AM
Roaming and local EXTRANGE samba problem!! VolatiL Linux - Enterprise 0 10-29-2005 01:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration