WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Rename default tc username  (Read 3332 times)

Offline caracalla

  • Newbie
  • *
  • Posts: 21
Rename default tc username
« on: July 11, 2018, 05:27:04 PM »
I know that this idea is a little bit out of the ordinary, but I would like to make it happen. I would like to rename an existing tc user account with something else. I know that there is a bootloader user option, but this one is actually adding a new user account with a default tcuser password and not renaming/replacing an existing one.

So I approached this problem by remastering initrd where I renamed all tc user entries with an account name of my choosing in the following files
/etc/passwd
/etc/shadow
/etc/sudoers
/etc/init.d/tc-config

Additionally, I updated /etc/shadow with my password hash and I also added noautologin option to the extlinux bootloader options list.

After some testing I can confirm that I am able to login to the system with my username and password, but it behaves a little bit strange. When I enter my credentials I need to press Enter button four more times (without writing password in) to get rid of password entry field and to get to the shell prompt.

It looks something like this:
Code: [Select]
   login: user_name          [Enter]
password: user_password      [Enter]
password:                    [Enter]
password:                    [Enter]
password:                    [Enter]
password:                    [Enter]
$:

I have no idea why system behaves this way, but my wild guess would be that I most probably missed/forgot to update one of the system/configuration files when remastering initrd.
If you have any suggestions or thoughts on what I should check or how I should approach this issue then let me know. Thank you!

Offline caracalla

  • Newbie
  • *
  • Posts: 21
Re: Rename default tc username
« Reply #1 on: July 12, 2018, 04:20:50 AM »
In addition to all things mentioned above I forgot to mention that I also updated /etc/sudoers file in a way that my custom username needs to enter password on sudo command. And this is exactly what was indirectly causing described strange behaviour. The reason there are multiple password entries after user login lies in the shell login script .profile.

Among other things there is also an entry
Code: [Select]
export BACKUP=1
[ "`id -un`" = "`cat /etc/sysconfig/tcuser`" ] && echo "$BACKUP" | sudo tee /etc/sysconfig/backup >/dev/null 2>&1

I am not sure what is the purpose of this line in the shell login script, but the thing is that it is executing sudo command which in my case requires password to be entered.

Searching the complete file system trying to figure out who is relying on value of /etc/sysconfig/backup gives me no result. As if this is some kind of leftover from way back.


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Rename default tc username
« Reply #2 on: July 12, 2018, 08:49:49 AM »
Hi caracalla
... Among other things there is also an entry
Code: [Select]
export BACKUP=1
[ "`id -un`" = "`cat /etc/sysconfig/tcuser`" ] && echo "$BACKUP" | sudo tee /etc/sysconfig/backup >/dev/null 2>&1

 ... Searching the complete file system trying to figure out who is relying on value of /etc/sysconfig/backup gives me no result. As if this is some kind of leftover from way back.

The  $BACKUP  environmental variable is used to determine whether or not to run a backup by default when shutting down. Its
value can be changed in the  .profile  file in your home directory.