jwkennedy651
Posts: 10
Joined: Wed Feb 25, 2015 4:29 am

Deleting 'pi' user

Wed Feb 25, 2015 4:36 am

Hello,

I have a Pi 2 model B running Raspbian. I recently created a new user ('joe') and granted this user sudo rights. Is it now safe for me to delete the default user pi? I do not have any important files stored in the old 'pi' home folder.

Thank you!

User avatar
DougieLawson
Posts: 36098
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Deleting 'pi' user

Wed Feb 25, 2015 9:31 am

As long as you don't have your system booting directly to the GUI you are good to go.

If you want your new ID to boot to the GUI you'll need to change /etc/inittab

Code: Select all

1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>\&1 
to

Code: Select all

1:2345:respawn:/bin/login -f joe tty1 </dev/tty1 >/dev/tty1 2>\&1 
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

jwkennedy651
Posts: 10
Joined: Wed Feb 25, 2015 4:29 am

Re: Deleting 'pi' user

Wed Feb 25, 2015 2:33 pm

I boot to the command line, so it should be fine.

Thank you for your help!

User avatar
Fidelius
Posts: 447
Joined: Wed Jan 01, 2014 8:40 pm
Location: Germany

Re: Deleting 'pi' user

Wed Feb 25, 2015 3:48 pm

I too deleted the "pi" user, and the pi group, and then added new users and their groups (mostly without sudo rights). So one or the other new user and group has now the same user ID and group ID as the former "pi" user had. And since then (I think) I see on my Pi2 another Kernel warning during boot in orange text colour, which says:

Code: Select all

(warn) PulseAudio configured for per-user-sessions... (warning)
(The other warning is about cgroups or a missing memory controller, which is also there on my Pi1.)

What could cause this newer PulseAudio warning, however? How could I correct it?


P.S: Which log file contains these Kernel messages inclusive Kernel warnings? I tried a few in /var/log/ but without success. Also the "dmesg" doesn't show the warnings.

User avatar
emgi
Posts: 357
Joined: Thu Nov 07, 2013 4:08 pm
Location: NL

Re: Deleting 'pi' user

Wed Feb 25, 2015 5:30 pm

A standard user is unlikely to have the same group memberships as user pi.
This causes all sorts of issues with application permissions.
In case of problems, check this:

Code: Select all

 $ cat /etc/group | grep pi
adm:x:4:pi
dialout:x:20:pi
cdrom:x:24:pi
sudo:x:27:pi
audio:x:29:pi
video:x:44:pi,leo
plugdev:x:46:pi
games:x:60:pi
users:x:100:pi
pi:x:1000:
netdev:x:105:pi
input:x:999:pi
spi:x:1002:pi
gpio:x:1003:pi
/emgi

User avatar
DougieLawson
Posts: 36098
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Deleting 'pi' user

Wed Feb 25, 2015 8:11 pm

Before you delete your pi user you can use

Code: Select all

for i in `groups`; do  sudo usermod -a -G $i joe; done
to add user joe to the groups user pi is defined in.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

jwkennedy651
Posts: 10
Joined: Wed Feb 25, 2015 4:29 am

Re: Deleting 'pi' user

Thu Feb 26, 2015 12:09 am

In the first place, I really just wanted to rename the 'pi' user. So, this is my new plan: Instead of deleting pi, I think I will remove the joe account I already made, delete its home directory, and then use:

Code: Select all

sudo usermod -l joe pi
to change my pi username to joe. I can then manually change the name of pi's home directory to joe. I think this way is probably the safest. Would this work?
-Joe
"Teen Maker"
Interested in all things Pi
Raspberry Pi 2 Model B running Raspbian

CorvusB
Posts: 31
Joined: Fri Apr 25, 2014 4:26 pm

Re: Deleting 'pi' user

Tue Apr 30, 2019 4:18 pm

DougieLawson wrote:
Wed Feb 25, 2015 8:11 pm
Before you delete your pi user you can use

Code: Select all

for i in `groups`; do  sudo usermod -a -G $i joe; done
to add user joe to the groups user pi is defined in.
Hmmmm, Dougie, there is a problem with that loop. I haven't figured out what yet, but seems to be something off with "groups".

I've figured out part of what might be the issue I'm seeing - you have to run that command loop AS THE USER PI. Or 'groups' won't return the right list. One could try

Code: Select all

for i in `groups pi`; do  sudo usermod -a -G $i joe; done
except that gives an extra "pi: " preceding the group list - might muck up the usermod sequence. I don't know - haven't tried it yet.

swampdog
Posts: 238
Joined: Fri Dec 04, 2015 11:22 am

Re: Deleting 'pi' user

Tue Apr 30, 2019 9:12 pm

Fwiw, I just 'sudo passwd -l pi' (lock) the "pi" user account.

Return to “Beginners”