Changing default Raspbian user at boot

Hi all,
Just having fun with the rPi I got for Christmas [what a delight!]
but the first thing sticking me is that I want to change the default
user from "pi" to my usual account name. (Don't need to add an account,
just change the name, which I can do in passwd but then presumably the
-- NOOBS -- boot sequence would fail.) I'd have thought there'd be a
config file somewhere with that info, but I can't find one.
In the 'recovery' partition, I see os/Raspbian/os.json with the name
and password, but I imagine if I edit that I then have to reinstall(?).
I'd rather do something a little less drastic if possible.
Thanks,
-- Pete --
Reply to
Pete
Loading thread data ...
Be sure to set a password for root defore starting on this path: you're likely to lock yourself out of sudo
Assuming you mean /etc/passwd, using the --login option of usermod might be easier eg: usermod --login pete pi
I don't think it needs to know the user name at kernel boot-time. if there's an auto-login that would be a display manager setting which should be possible to re-set fairly easily.
--
For a good time: install ntp
Reply to
Jasen Betts
I think you'd be in for a whole lot of trouble if you rename user pi. Much easier to add a new user. Log in as pi to the command prompt or open a terminal window. Then:
1. Add new user "pete" $ sudo adduser pete (it asks for a new password) 2. Make pete a sudo-er $ sudo visudo (duplicate last line with Ctrl-k, Ctrl-u, Ctrl-u, replace pi with pete) 3. See of which groups old user pi is a member $ groups pi 4. Either add new user to one group $ sudo adduser pete audio or to all groups of pi except pi's own group $ for i in $(groups pi | sed 's/.*: //' | sed 's/^pi //'); do sudo adduser pete $i; done 5. Optionally change boot to desktop to new user sudo nano /etc/lightdm/lightdm.conf (edit: autologin-user=pete) 6. Log out or reboot, log in as new user pete with password you gave in step 1.
Reply to
A. Dumas
My experience was with Sun Solaris UNIX and I'm sure I could add another entry in the passwd file using the same userid number but different name. Allowed you to login using 2 different names. But any lookup to userid just returned first name i.e. for file ownership details in ls -l.
Reply to
robert
Sounds like a bad idea to me - I wouldn't be surprised if it resulted in undefined behaviour, because the system doesn't expect more than one username per UID.
Reply to
Rob Morley
Maybe - but the only time the file gets used ( I believe) is at logon when it assigns a userid based on the username field. From then on userid is used by the system. There is probably never any reason to do this on a domestic system but in a large dept this ploy must have had its uses otherwise I probably wouldnt have used it ( I hope).
Reply to
robert
AIUI uid/gid is used throughout as the identifier of a user: occasionally I have seen two name/password combinations used to access the same effective account. It is confusing as most UID/GID pairs are logged via the first entry in the password file when mapping UID back to human readable form.
It is always better really to do the hard work of setting up permissions for a unique user.
the other is a bit of a hack that was IIRC used to give someone temporary access to an administrative area without going to the hassle of doing the job properly.
IN short: it works, but please don't.
--
Ineptocracy 

(in-ep-toc?-ra-cy) ? a system of government where the least capable to  
 Click to see the full signature
Reply to
The Natural Philosopher
[I haven't had a chance over the New Year to get back to my Pi (:-() but I thought I ought to respond before things get too stale...! ] In article ,
Jasen Betts wrote:
Good point... I'll do that.
AH, yes, that was probably what I was looking for. Amazing how after running Unix/Linux systems all these years there are still so many commands i've never happened to learn!
After reading the other response, though, maybe it's a bit better just to set up a separate account, and make that the default.
Thanks,
-- Pete --
Reply to
Pete
[As I said in my other response, I still haven't had a chance to try things, but...]
Can you suggest what sort of trouble this might be? In all the Linux systems I've built over the years, the default user has always been pretty arbitrary; only 'root' is inviolate.
I'll probably do this anyway, as keeping 'pi' around doesn't really have any overhead.
Thanks for the detailed step-by-step. I think I have all the info I need now. [...]
Not sure this is necessary. haven't checked Raspbian yet, but on my Ubuntu laptop (and other systems I happened to have handy to look at) sudo-enabled users are just in the 'sudo' entry in /etc/group. The sudoers file has never been changed. [....]
Ahh... *That* was the config file I was looking for!
Thanks,
-- Pete --
Reply to
Pete
Ah, well, maybe not so bad after all. Never used unix/linux other than as a user academically and as a hobby personally. For instance, I didn't know about usermod --login. My impression was that the main user was referenced by name in all sorts of places, but maybe not in the core functionality.
That was a wrong description by me. I guess I meant: make sudo-behaviour the same for the new user as it was for pi. Specifically, no password prompt for any command.
Reply to
A. Dumas
Finally got to taste some more Pi... (Amazing how many things can get in the way! (:-))) So I was eventually able to get my alternate default user.
Me neither... (:-/)
I decided just to add a new user, but I suspect it might have been easier just to rename pi. I made several initial omissions getting there. One thing we forgot was that pi has a default Desktop -- when I booted into 'pete' it was blank! Needed a 'sudo cp -apR * ../pete' -- which of course skipped all the '.' files, so I had to copy them too -- and then do the requisite chown's in that directory (and descendants) to get a useable startup.
I think I've got it now, though.
u>
You were right, actually. Being a member of the sudo group just gives permission to use it. Doing it without a password needs a sudoers entry. Apologies.
Cheers, -- Pete --
Reply to
Pete

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.