On 05/09/15 18:15, Chris Green wrote:
As per the subject.
I have a Raspberry Pi with the latest raspbian installed. I've told it to run the GUI at boot. I want to change the user that it boots into, i.e. I don't want it to boot into the default user 'pi'.
How does one do this? Google searching brought up all sorts of things about changing the pi login but not what I wanted to do.
Not entirely sure - I think I've managed it myself but can't remember exactly how.
I'd be tempted to try something like this, see what happens, and take it from there.
The boot user and the gui are either going to be controlled by the user name "pi" or the user id. (They must be in a config file somewhere!)
First, create a new user login. Make sure you can log-in using ssh (or somehow) with this user. Ensure this user can run SUDO. Once that's working. Leave it alone. This will let you fix things if it goes wrong.
Now create a another new user. For this post I'm going to assume it's user ID 500, and call it NewPi. Give this user exactly the same permissions and group membership as the pi user. Ensure it can also use SUDO. You could copy (not move) across all the files from Pi's home directory too, but if you do, make sure you change ownership to the new user's ID.
Then backup then edit the shadow and passwd files. Change user name "Pi" to "OldPi". Change user name "NewPi" to "Pi". The new user ID 500 will now be called Pi.
Reboot. There will be two scenarios: a) It logs in as user OldPi. This means that the login is controlled by the user id. In this case, Change the name OldPi to the name you want it to be, and use user 500 as a new "Pi" account.
b) It logs in as user Pi, user id 500. If this is the case, I'd be fairly sure that the login name must be stored in a login config file somewhere.
I think actually that I managed this user change by carefully planning the installation. I think the username I created at boot time I called administrator and gave it sudo permissions etc. I then setup a pi user which I gave similar permissions to (but not as many privileges). I then ran the config program that told it to boot into the gui and it booted as pi, but pi was not the privileged user.
Good luck!
Steve