[Samba] Change samba username with tdbsam backend

John H Terpstra jht at samba.org
Fri Feb 19 20:07:02 MST 2010


On 02/19/2010 08:51 PM, Eden Caldas wrote:
> You are not sure if it will work? 

Right. It should work. Try it. But there will be a loss of information.

> So there's no way of doing this without losing information?

Correct.

The tdbsam (passdb.tdb) file stores more information than the smbpasswd
file does.

You should execute:

	pdbedit -Lv user_name

and make careful record of the user's SID and other Windows per-user
settings.  You may have to restore that separately using pdbedit.

Password aging information will be lost.  Any per-user setting for
Windows home folder, profile information, per-user logon script, etc.
will be lost unless you reset it.

- John T.

> 
> 2010/2/20  <guido at lorenzutti.com.ar>:
>> A very small contribution... you should also rename the user in passwd and
>> shadow.
>>
>>> On 02/19/2010 08:39 PM, Eden Caldas wrote:
>>>>  a) The users' name in the passdb.tdb file
>>>>
>>>> That's what I want to know. How do I do it?
>>>
>>> OK - you will lose information, but here is a quick solution:
>>>
>>> a) pdbedit -i tdbsam -e smbpasswd
>>> b) pdbedit  -x user_name
>>> c) Edit the smbpasswd file (it is a text file)
>>> d) pdbedit -i smbpasswd -e tdbsam
>>>
>>> I am not sure it will work, but try it - what do you have to lose?
>>>
>>> - John T.
>>>
>>>>
>>>> 2010/2/20 John H Terpstra <jht at samba.org>:
>>>>> On 02/19/2010 06:52 PM, Eden Caldas wrote:
>>>>>> How do you do this? This thing is a binary file. And I see no command
>>>>>> lines for it.
>>>>>>
>>>>>> ex; I have an username named Miranda and I want to change to Liara.
>>>>>
>>>>> OK, this is a question that has been asked many times on this list. A
>>>>> complete solution depends on the Samba password backend being used, and
>>>>> on how far you want to go in terms of consistency of change.
>>>>>
>>>>> For example:
>>>>>
>>>>> 1) If the "passdb backend = smbpasswd", it is necessary to change:
>>>>>
>>>>>        a) The user login name in the smbpasswd file
>>>>>        b) The user login name and GECOS information in /etc/passwd and
>>>>> in
>>>>> /etc/shadow, and all group membership information in /etc/groups
>>>>>        c) The name of the user's home directory
>>>>>        d) The name of the user's desktop profile directory on all MS
>>>>> Windows
>>>>> machine the user makes use of.
>>>>>
>>>>>
>>>>> 2) If the "passdb backend = tdbsam", it is necessary to change:
>>>>>        a) The users' name in the passdb.tdb file
>>>>>        b) The users' login name and GECOS information in /etc/passwd
>>>>> and in
>>>>> /etc/shadow, and all group membership information in /etc/groups
>>>>>        c) The name of the user's home directory
>>>>>        d) The name of the user's desktop profile directory on all MS
>>>>> Windows
>>>>> machine the user makes use of.
>>>>>
>>>>>
>>>>> 3) If the "passdb backend = ldapsam", it is necessary to change:
>>>>>        a) The users' identity information in a consistent manner in
>>>>> his/her
>>>>> account record and in all group memberships
>>>>>        b) The name of the user's home directory
>>>>>        c) The name of the user's desktop profile directory on all MS
>>>>> Windows
>>>>> machine the user makes use of.
>>>>>
>>>>>
>>>>>
>>>>> The problem is that if the account information is deleted (can be done)
>>>>> it must be restored with the same UID and GID, and with full
>>>>> preservation of the users' fully qualified SID.  If this does not
>>>>> happen, his/her profile will not longer work correctly and user
>>>>> applications will be broken in the MS Windows environment.
>>>>>
>>>>> There exists no simple, portable tool that can affect the type of
>>>>> change
>>>>> you are seeking.  At the best of times, this is a a complex
>>>>> administrative task that requires knowledge of the consequences of each
>>>>> step taken.  A failure to apprehend such consequences will lead ot
>>>>> interesting observations and results.
>>>>>
>>>>> - John T.
>>>>> --
>>>>> To unsubscribe from this list go to the following URL and read the
>>>>> instructions:  https://lists.samba.org/mailman/options/samba
>>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> To unsubscribe from this list go to the following URL and read the
>>> instructions:  https://lists.samba.org/mailman/options/samba
>>>
>>
>>
>> --
>> To unsubscribe from this list go to the following URL and read the
>> instructions:  https://lists.samba.org/mailman/options/samba
>>



More information about the samba mailing list