WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Correct method to change tc user to own user without adding another account?  (Read 1829 times)

Offline onelife

  • Full Member
  • ***
  • Posts: 141
Hi there,

Previously I have added another user to TC so as to be the user I require for my app. However, this seems a bit unnecessary as I don't need the default tc user and I would just like to change that user - But besides the boot option that only changes the prompt to "user"@tc - what would be the best / correct way to keep only 1 user for the system BUT change that user from tc > xyz.

The change would be all aspects, home folder, profile, bashrc, passwd, groups etc - those are the files that after adding my "xyz" user I normally then edit so as to give my new user "xyz" all the same access as the default tc user.

Really think I might be missing something as an easy way to just change the name of the current default user?

Many Thanks

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11325
Hi onelife
To remove a user, you can try:
Code: [Select]
sudo deluser tc
If you want the users home directory removed as well:
Code: [Select]
sudo deluser --remove-home tc

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10993
That's exactly what the boot option is for? It does not just change the prompt.
The only barriers that can stop you are the ones you create yourself.

Offline KeithA

  • Newbie
  • *
  • Posts: 7
I don't think this and the related topic: http://forum.tinycorelinux.net/index.php/topic,23605.msg148094.html have yet been fully answered.

Ignoring the restriction of not adding another user I've been looking at how to change tc to a user of choice and have a solution.
In the example here the user of choice is admin. This is a summary.

On a uSD card freshly imaged with PiCore 13.1.0 add user=admin to Boot partition cmdline.txt ensuring a Unix line ending of LF. I used Notepad++.

Insert card into Pi and power on. I used an SSH connection.

Login as tc, password piCore

If you view the sudoers file with:
 sudo cat /etc/sudoers
The last two lines read:

You can see admin has the same sudo privileges as tc

If you view user account information with:
 cat /etc/passwd
There is an entry for tc
tc:x:1001:50:Linux User,,,:/home/tc:/bin/sh

But no entry for admin which is why you can't log in as admin

If you view the group account information with:
 cat /etc/group

There is an entry

tc's gid is 50 which is staff

Now have enough information to create user account admin:
 sudo adduser -G staff admin
Enter password twice

Login as admin:
 login admin
Enter admin password

Remove user tc:
 sudo deluser --remove-home tc

Get the response:
deluser: can't find tc in /etc/group

However if you view the group account information you will see that tc is no longer a user.

Very Important!
Save and reboot:
 filetool.sh -b
 sudo reboot


After preparing the uSD card, the entire session for making the change is shown here:

login as: tc
tc@'s password:
   ( '>')
  /) TC (\   Core is distributed with ABSOLUTELY NO WARRANTY.
 (/-_--_-\)           www.tinycorelinux.net

tc@box:~$ sudo adduser -G staff admin
Changing password for admin
New password:
Retype password:
passwd: password for admin changed by root

tc@box:~$ login admin
   ( '>')
  /) TC (\   Core is distributed with ABSOLUTELY NO WARRANTY.
 (/-_--_-\)           www.tinycorelinux.net

admin@box:~$ sudo deluser --remove-home tc
deluser: can't find tc in /etc/group