Changing the user name

Laszlo Papp lpapp at kde.org
Wed May 14 06:43:35 UTC 2014


On Wed, May 14, 2014 at 7:40 AM, Ralf Friedl <Ralf.Friedl at online.de> wrote:
> Laszlo Papp wrote:
>>
>> On Wed, May 14, 2014 at 7:28 AM, Ralf Friedl <Ralf.Friedl at online.de>
>> wrote:
>>>
>>> Laszlo Papp wrote:
>>>>
>>>> is this possible? I am looking for something like "usermod -l" on
>>>> desktop.
>>>>
>>>> Alternatively, I have to look into the get/setpwent syscalls?
>>>
>>> You can also use sed to change /etc/passwd
>>>
>>> sed -i -e /s^olduser:/newuser:/ /etc/passwd
>>
>> Yeah, plus I need to move (i.e. rename) the home folder and then I
>> think I am done. Thanks.
>
> You should note that usermod doesn't do that anyway:
>        -l, --login NEW_LOGIN
>            The name of the user will be changed from LOGIN to NEW_LOGIN.
> Nothing else is changed. In particular, the user's home directory or mail
> spool should probably be renamed manually to reflect the new login name.

usermod does do that:

  -m, --move-home               move contents of the home directory to the
                                new location (use only with -d)


More information about the busybox mailing list