Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: GNUser on July 28, 2019, 10:19:45 PM
-
I have a partition with some personal files that various UNIX-like OSs need to access. All files in the partition have user:group ownership of 1000:1000.
My tc user is having permissions problems because its uid is 1001 and gid is 50. Is there a way to tell TC to use uid 1000 for user tc?
I already changed this line in /etc/init.d/tc-config:
/usr/sbin/adduser -s /bin/sh -G staff -D "$USER"
to
/usr/sbin/adduser -u 1000 -s /bin/sh -G staff -D "$USER"
and re-made core.gz, but even with the modified core.gz my tc user still ends up with uid=1001 for some reason.
-
Oops, I just noticed that the addUser function in /etc/init.d/tc-config is only called if booting with user=foo where foo is other than tc. I also noticed that the /etc/passwd file in core.gz already has an entry for tc.
Therefore, I solved my problem by changing this line in /etc/passwd
tc:x:1001:50:Linux User,,,:/home/tc:/bin/sh
to this
tc:x:1000:50:Linux User,,,:/home/tc:/bin/sh
Solved :)
P.S. If you need to modify your core.gz for some reason, here are the steps I used:
# mkdir /tmp/dest
# cd /tmp/dest
# gunzip -c /path/to/core.gz | cpio -i
-> change /tmp/dest contents
# cd /tmp/dest
# find . | cpio -H newc -o | gzip -9 > ../core.gz-new
-
Hi GNUser
You could have also run:
sudo /usr/sbin/adduser -u 1000 -s /bin/sh -G staff -D GNUser
after booting. Then logout and login as GNUser.
-
Thanks, Rich. That's a nice alternative I hadn't thought of.
-
Hi GNUser
Yup, lots of ways to skin a cat problem in linux:
sudo chown 1001:1001 *
Access your files, then:
sudo chown 1000:1000 *
-
You could have also run:
sudo /usr/sbin/adduser -u 1000 -s /bin/sh -G staff -D GNUser
after booting. Then logout and login as GNUser.
I like this solution the best, as I want to avoid having to modify core.gz and want to avoid having to remember to change permissions before and after accessing the files.
Is there a way to automate the above (i.e., after booting, automatically run the command then automatically logout tc and login GNUser)?
-
Hi GNUser
Add the following to your /opt/.filetool.lst file:
etc/group
etc/gshadow
etc/passwd
etc/shadow
etc/sudoers
Run the adduser command and then run a backup. User GNUser will now be persistent.
-
Wow, cool :o
Thank you, Richard. Indeed, there are so many ways to solve a problem using *nix tools... It's an embarrassment of riches.
-
Today I discovered, quite by accident, that simply using user=gnuser boot code is enough: user gnuser is created with uid=1000. No need to manually create the user or backup any files. Thank you, Robert Shingledecker :)