wmnally5
Posts: 65
Joined: Thu Sep 13, 2018 9:35 pm

Renaming of 'pi' to 'pi-newname' and proposed changes to /etc files - as my added 'user':

Sat Nov 03, 2018 7:42 pm

Everyone:

There are only 2 questions in ths post - any help appreciated:


There are many cautionary remarks about making these changes as the root user that I hope to avoid.

Be aware that that I currently boot to Desktop 'pi' with Raspbian Stretch. After loggng out of 'pi' and loging in as my other 'user'. I issued the kill command to each pi process id that that was listed from ~400 to over ~2100, but discontinued this process [after about 30 kill commands] because 1) I was not sure how many pi processes there were and 2) I thought that the same one might be opening after each kill command as follows:

sudo usermod -l 'pi-newname' 'pi'

'user pi currently used by process xxx'

'kill xxx'

sudo usermod -l 'pi-newname' 'pi'

'user pi currently used by process xyz'

'kill xyz'
.
.
.


In addition, I did not think I would be able to subsequently edit to the below mentioned /etc/inittab, /etc/passwd, /etc/shadow, /etc/group and /etc/lightdm files with so many killed pi processes logged on to my 'user'.


Finally, I am not deleting 'pi', just renaming to 'pi-newname'. In an earlier 2015 DougieLawson post, he posted a comment about /etc/inittab file-line for GUI booting - I currently boot the Desktop 'pi' and want to boot to 'pi-newname'; does this file also need editing from 'pi' to 'pi-newname' in addition to the other/below listed 2015 DougieLawson posted files?

1st DougieLawson response:


Re: Deleting 'pi' user
Report this postQuote
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


I also plan to perform the following edits based upon the following/later DougieLawson post which was also deleting 'pi' which, again, I do not want to do. My proposed/below edits seem necessary if I keep both my users ('pi-newname' and 'user'); I just want to boot into my 'pi-newname'. Do I just replace 'pi' with 'pi-newname' once I get the above usermod command and kill commands to properly run? I plan to make all edits here as my other 'user', including lightdm edits before rebooting to 'pi-newname'.

2nd DougieLawson response:

Re: Delete pi user in Raspbian
Quote
Mon Jan 15, 2018 11:13 pm

Crude and ugly way is sudo nano /etc/passwd; sudo nano /etc/group; sudo nano /etc/shadow;
Change pi to your new ID in those three files then reboot.

If you use the GUI you'll need to muck about with the lightdm autologin stuff.


Thanks for your assistance - the needed lightdm edits are straightforward!

I plan to perform the following edits that seem needed for 'pi' to 'pi--newname' only, keeping 'user' listings as both needed in these files because there 2 users on my system.

Logged in as my other 'user', I plan to edit the below 3 files following the above instructions which should apply to my case where I am just renaming 'pi' to 'pi-newname'. In the following files, do I just change 'pi' to 'pi-newname' once I get the above usermod command and kill commands to properly work?


1) I find the following - 'pi' and 'user' only occur in /etc/passwd file as follows:

pi . 00:10 . bin/bash

user . 01:10 . bin/bash


2) 'pi' and 'user' occur in /etc/group file as follows - note 'pi' and 'user' both occur together throughout this file with only the following unique occurrences:

pi . 00:

user . 01:


3) 'pi' and 'user' only occur in /etc/shadow as follows:

pi . (a unique complicated string of characters)

user . (this is a different complicated string of characters)

k-pi
Posts: 912
Joined: Sun Feb 12, 2017 1:46 pm
Location: Upper Hale, Surrey, UK.

Re: Renaming of 'pi' to 'pi-newname' and proposed changes to /etc files - as my added 'user':

Sun Nov 04, 2018 11:43 am

From what I understand, changing 'pi' to your newly created 'newuser' in etc/inittab, will log you in as 'newuser', leaving the 'pi' user still as an option, until removed/deleted, which I don't think is your intention. Then you will need to alter your GUI to start as 'newuser' instead of 'pi'.

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

Re: Renaming of 'pi' to 'pi-newname' and proposed changes to /etc files - as my added 'user':

Sun Nov 04, 2018 1:24 pm

No such thing as /etc/inittab with Jessie or Stretch. That was an old sysvinit thing that was removed with systemd.

Renaming pi by editing /etc/passwd is NOT recommended in any way (until you really understand what that means and what it does). When you break your system by doing that I'm going to happily tell you, "I told you so".
Note: Having anything remotely humorous in your signature is completely banned on this forum. Wear a tinfoil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

n67
Posts: 938
Joined: Mon Oct 30, 2017 4:55 pm

Re: Renaming of 'pi' to 'pi-newname' and proposed changes to /etc files - as my added 'user':

Sun Nov 04, 2018 1:28 pm

Renaming pi is NOT recommended in any way (until you really understand what that means and what it does).

Seriously, every time this comes up, I have to ask "Why?" There really is no good reason to do it.

The problem, as is so often the case, is old/obsolete tuts (websites) out there - that recommend this.
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!

wmnally5
Posts: 65
Joined: Thu Sep 13, 2018 9:35 pm

Re: Renaming of 'pi' to 'pi-newname' and proposed changes to /etc files - as my added 'user':

Sun Nov 04, 2018 4:45 pm

n67: Why? for security reasons! The Raspbian organization knows 'pi' is a problem - see the weblink below. I figure renaming 'pi' is safer than deleting 'pi' as suggested in this posted website:


https://www.raspberrypi.org/documentati ... ecurity.md


OK - I have a very secure passwd, and have installed the recommended security programs (ufw and fail2ban) as recommended at the above site - do I just need to be patient now as Raspbian develops?


DougieLawson: However, not recommended by you for me you, did say the following which is what I am attempting to do in this post - please inform me as to how to properly accomplish what you stated below or recommend to me not to do so:


Re: Raspbian Stretch fail2ban - New Post
Report this postQuote
Thu Oct 18, 2018 9:26 am

I've got 17 jails enabled. The pi userid doesn't exist (I've renamed it).
.
.
.


My greatest appreciation to n67 and DougieLawson for addressing my comments!

User avatar
HawaiianPi
Posts: 4453
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Renaming of 'pi' to 'pi-newname' and proposed changes to /etc files - as my added 'user':

Sun Nov 04, 2018 7:35 pm

If you don't want to delete the pi user, then create your new user and disable the pi user with,

Code: Select all

sudo passwd --lock pi
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

wmnally5
Posts: 65
Joined: Thu Sep 13, 2018 9:35 pm

Re: Renaming of 'pi' to 'pi-newname' and proposed changes to /etc files - as my added 'user':

Sun Nov 04, 2018 10:04 pm

Hi HawaiinPi:

Say hello to zoomzoom from me!

As you proposed before, it was always my intent to do your command to lock my 'pi-newname' or 'pi' once I hear from DougieLawson. If needed, please tell me whether it can be unlocked via:

sudo passwd --unlock pi

I cannot find a definitive reference that says this unlock command works. Please tell me what to do to unlock 'pi' locked by your method:

sudo passwd --lock pi

This is important, to be able to unlock 'pi', if there are 'pi' system problems with 'pi' locked in this way - have you had any problems with 'pi' locked in this way? Please let me know!

HawaiianPi: Thanks for all your input, teaching me much about 'pi'!

wmnally5
Posts: 65
Joined: Thu Sep 13, 2018 9:35 pm

Re: Renaming of 'pi' to 'pi-newname' and proposed changes to /etc files - as my added 'user':

Mon Nov 05, 2018 9:39 pm

HawaiianPi:

I apologize! I see now that I am dealing with a Raspbian political issue. I checked the manual and I now see that 'pi' is locked and unlocked with with the passwd commands.

2 final questions I need answered, before proceeding and with just your/HawaiianPi input - without further DougieLawson input (unless needed for the following 2 questions):

1) Can I boot to Desktop with 'pi' locked in this way?

2) Please let me know if you have had or there are any 'pi' system problems with 'pi' locked in this way?

I await your response to wrap this issue up. Again, thanks for all your great input about Raspbian 'pi'!

wmnally5
Posts: 65
Joined: Thu Sep 13, 2018 9:35 pm

Re: Renaming of 'pi' to 'pi-newname' and proposed changes to /etc files - as my added 'user':

Mon Nov 05, 2018 10:52 pm

HawaiianPi:

Please assist - As I said above, I checked the manual and will await your response!

Did what you suggested with lock of 'pi' which properly booted to my Desktop!

However, I cannot unlock 'pi' even adding an ! to the beginning of my passwd. Here is the message I received locking:

[email protected]:~ $ sudo passwd --lock pi
passwd: password expiry information changed.
[email protected]:~ $ exit

What about expiration - I would like a notice prior to expiration!

No response to any passwd commands because it is locked - is it locked forever now? I require a passwd for all my sudo commands. Please tell me how to unlock!

[email protected]:~ $ sudo passwd --status pi
[sudo] password for pi:
Sorry, try again.
[sudo] password for pi:
Sorry, try again.
[sudo] password for pi:
sudo: 3 incorrect password attempts
[email protected]:~ $ sudo passwd --unlock pi
[sudo] password for pi:
Sorry, try again.
[sudo] password for pi:
Sorry, try again.
[sudo] password for pi:
sudo: 3 incorrect password attempts

Milliways
Posts: 425
Joined: Fri Apr 25, 2014 12:18 am
Location: Sydney, Australia

Re: Renaming of 'pi' to 'pi-newname' and proposed changes to /etc files - as my added 'user':

Mon Nov 05, 2018 11:14 pm

If you have "locked" pi this just mangles the password.

You should (as root) be able to set a new password for user pi.

wmnally5
Posts: 65
Joined: Thu Sep 13, 2018 9:35 pm

Re: Renaming of 'pi' to 'pi-newname' and proposed changes to /etc files - as my added 'user':

Mon Nov 05, 2018 11:48 pm

HawaiianPi/Milliways:

Milliways: Thanks for the information which I do not understand - too many cautionary remarks about root, and I do not want to compound problem - just unlock pi which the manual specifies can be done. HawaiianPi: For completeness, I also tried without success the following - which usually means sudo is needed:

[email protected]:~ $ passwd --unlock pi
passwd: Permission denied.
[email protected]:~ $ exit

HawaiianPi: Evidently, I have a problem because unlock does not work under my circumstances - requiring sudo passwd. HawaiianPi, I will patiently await your instructions on properly unlocking pi or PLEASE LET ME KNOW IF I HAVE TO RELOAD RASPBIAN. THIS RASPBIAN IS VERY FRUSTRATING EVEN WHEN YOU FOLLOW THE MANUAL. THANKS!!!

Milliways
Posts: 425
Joined: Fri Apr 25, 2014 12:18 am
Location: Sydney, Australia

Re: Renaming of 'pi' to 'pi-newname' and proposed changes to /etc files - as my added 'user':

Tue Nov 06, 2018 12:40 am

wmnally5 wrote:
Mon Nov 05, 2018 11:48 pm
HawaiianPi/Milliways:

Milliways: Thanks for the information which I do not understand - too many cautionary remarks about root, and I do not want to compound problem - just unlock pi which the manual specifies can be done. HawaiianPi: For completeness, I also tried without success the following - which usually means sudo is needed:

[email protected]:~ $ passwd --unlock pi
passwd: Permission denied.
[email protected]:~ $ exit

HawaiianPi: Evidently, I have a problem because unlock does not work under my circumstances - requiring sudo passwd. HawaiianPi, I will patiently await your instructions on properly unlocking pi or PLEASE LET ME KNOW IF I HAVE TO RELOAD RASPBIAN. THIS RASPBIAN IS VERY FRUSTRATING EVEN WHEN YOU FOLLOW THE MANUAL. THANKS!!!
ALL you have to do is run

Code: Select all

sudo passwd pi
from any sudoers account you can login to.

User pi CANNOT do it as it is locked!!!

wmnally5
Posts: 65
Joined: Thu Sep 13, 2018 9:35 pm

Re: Renaming of 'pi' to 'pi-newname' and proposed changes to /etc files - as my added 'user':

Tue Nov 06, 2018 2:20 am

Milliway:

Thanks for your help but I do not think this works. I will resume tomorrow - I am too tired, now:

[email protected]:~ $ su bill
[email protected]:/home/pi $ su passwd pi
No passwd entry for user 'passwd'
[email protected]:/home/pi $ exit
exit
[email protected]:~ $ exit

wmnally5
Posts: 65
Joined: Thu Sep 13, 2018 9:35 pm

Re: Renaming of 'pi' to 'pi-newname' and proposed changes to /etc files - as my added 'user':

Tue Nov 06, 2018 4:21 am

Milliway/HawaiianPi:

Thanks so much; your advice helped as I fixed the problem by unlocking pi from my other user that you suggested to perform my commands from. I know now how to unlock my pi when I need to do so - I referred to my HawaiianPi posts explaining how pi worked!

Long, frustrating day - goodnight!

User avatar
HawaiianPi
Posts: 4453
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Renaming of 'pi' to 'pi-newname' and proposed changes to /etc files - as my added 'user':

Tue Nov 06, 2018 8:32 am

No, I have not had any problems with the pi user locked.

You can unlock the pi user as you anticipated (sudo passwd --unlock pi), but you must make changes to the pi account from another account (a different account that can sudo). You could also just assign pi a new password, which is the way I have to unlock it, because I usually give pi a random password before locking it (probably overkill and not necessary, but easy enough to do).
wmnally5 wrote:
Tue Nov 06, 2018 2:20 am
[email protected]:/home/pi $ su passwd pi
No passwd entry for user 'passwd'
That command should be, sudo passwd pi
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

Return to “General discussion”