[lug] Migrating Ubuntu User Name

Stephen Queen svqueen at gmail.com
Mon Oct 19 06:14:25 MDT 2015


sudo -i
will make you root.
To directly edit,
Change the user name in /etc/passwd
Change the user name in  /etc/shadow
Change the user name in every place you find it in /etc/group
Change the user name in /etc/sudoers
Change the /home directory name to the newuser name (don't forget to do
that in /etc/passwd as well)
You may have to temporarily make some files writable depending on your
editor.

If I've missed a spot, it will become obvious.

If your embedded system OS is located on a removable device such as an SDHC
disk, you can mount it on a regular linux system and edit it from there.
But careful that the user name assign to the file isn't changed.

Steve

On Sun, Oct 18, 2015 at 5:20 PM, Jed S. Baer <blug at jbaer.cotse.net> wrote:

> On Sun, 18 Oct 2015 23:03:00 +0000 (UTC)
> stimits at comcast.net wrote:
>
> > I'm not really an "ubuntu person", I'm not sure how to unlock root on
> > it. I've spent most of my life with fedora or redhat variants. How does
> > one unlock root on ubuntu other than sudo?
>
> I haven't had to do it in quite a while. I think the command is
>   sudo passwd root
>
> And, the act of setting the password also unlocks the account.
>
> However,
> > FYI, the systems in question
> > are embedded, use a u-boot boot loader, and have no such thing as a
> > rescue disk or single user mode available. Part of why I'm hoping to
> > find a way to do this with direct editing is to make it possible to
> > hand edit loopback mounted images used for flashing the devices, rather
> > than actually having to manually log in to a device after it is
> > flashed.
>
> Well then if you have the filesystem, sitting there, loopback mounted,
> then you aren't booted to it, so your problem of usermod being unable to
> modify an account in use wouldn't seem to apply. And how to unlock root
> seems a moot point as well.
>
> > There are all kinds of reasons while doing development that
> > having the ubuntu account changed to a new name using the same UID/GID
> > would make life easier, as well as related to dealing with windows
> > machines attached to the devices. A small part of wondering how this
> > can be done and what the risks are are simply educational curiosity
> > which might help knowing in the future.
>
> I haven't messed with direct modification of /etc/passwd and /etc/groups
> in quite a while - would've been back in the 90's, I think. But I can't
> think of any reason why it wouldn't work to do it, keeping in mind prior
> comment about the shadow files.
>
> And I don't know what sort of tangled web might exist with how many
> scripts and/or config files assuming the "Ubuntu" user exists.
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20151019/a7f8f4db/attachment.html>


More information about the LUG mailing list