WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: TCL 8.x rootfs.gz files all owned by root:root  (Read 665 times)

Offline MSumulong

  • WikiUser
  • *
  • Posts: 24
TCL 8.x rootfs.gz files all owned by root:root
« on: September 27, 2017, 02:03:38 PM »
Somehow, all of the files in rootfs.gz of TCL 8.x are owned by root:root which I think should definitely not be the case.

@hiro has pointed this out earlier that I also discovered when using TCL 8.x's rootfs.gz.
after running "/usr/local/bin/cpio -i" on http://tinycorelinux.net/8.x/x86/release/distribution_files/rootfs.gz
many dirs are owned by root instead of staff.


There are a lot of directories that were once owned by root:staff (uid=0:gid=50) are now just root:root. Comparing the previous 7.x version of rootfs.gz shows that there are files that are owned by root:staff such as /opt:

Code: [Select]
drwxrwsr-x   2 0        50              0 Jul  4  2016 opt
-rw-rw-r--   1 0        50             31 Jul  4  2016 opt/tcemirror
-rwxrwxr-x   1 0        50             51 Jul  4  2016 opt/bootlocal.sh
-rw-rw-r--   1 0        50              9 Jul  4  2016 opt/.filetool.lst
-rwxrwxr-x   1 0        50            613 Jul  4  2016 opt/shutdown.sh
-rw-rw-r--   1 0        50            145 Jul  4  2016 opt/.xfiletool.lst
-rwxrwxr-x   1 0        50            272 Jul  4  2016 opt/bootsync.sh

Looking at /opt in TCL 8.x's rootfs.gz shows the files changed to gid=50:

Code: [Select]
drwxrwsr-x   2 0        0               0 Sep 21 12:16 opt
-rwxrwxr-x   1 0        0             272 Sep 21 12:16 opt/bootsync.sh
-rw-rw-r--   1 0        0             145 Sep 21 12:16 opt/.xfiletool.lst
-rwxrwxr-x   1 0        0             613 Sep 21 12:16 opt/shutdown.sh
-rw-rw-r--   1 0        0               9 Sep 21 12:16 opt/.filetool.lst
-rwxrwxr-x   1 0        0              51 Sep 21 12:16 opt/bootlocal.sh
-rw-rw-r--   1 0        0              31 Sep 21 12:16 opt/tcemirror
I've attached the full file listing of both TCL 8.x and 7.x's rootfs.gz.


rootfs.gz downloaded from the following links:
http://tinycorelinux.net/8.x/x86/release/distribution_files/rootfs.gz
http://tinycorelinux.net/7.x/x86/release/distribution_files/rootfs.gz

Used the following command to get the file listings:
Code: [Select]
gzip -dc rootfs.gz | cpio -tvn > cpio-listing

Offline polikuo

  • Sr. Member
  • ****
  • Posts: 250
Re: TCL 8.x rootfs.gz files all owned by root:root
« Reply #1 on: September 27, 2017, 11:11:02 PM »
Here's a quick script to find out the differences:
save this script as "chk_permissions"
Code: [Select]
#!/bin/sh
OLD=$1
NEW=$2
save_diff_as() {
ls -Ral | awk '{
if (/\->/)
print $1,$3,$4,($(NF-2))
else
print $1,$3,$4,$NF
}' > $1
}
cd $OLD || exit 1
save_diff_as /tmp/${OLD}.lst
cd - || exit 1
cd $NEW || exit 1
save_diff_as /tmp/${NEW}.lst
cd - || exit 1
diff -u /tmp/${OLD}.lst /tmp/${NEW}.lst | tee /tmp/ownership.diff

FYI
I extracted "rootfs-7.gz" to /tmp/7, "rootfs-8.gz" to /tmp/8
Run "chk_ownership /tmp/7 /tmp/8"

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 9633
Re: TCL 8.x rootfs.gz files all owned by root:root
« Reply #2 on: September 28, 2017, 01:09:09 AM »
I'm away this week, I'll have a look as soon as I get back .

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 9633
Re: TCL 8.x rootfs.gz files all owned by root:root
« Reply #3 on: September 28, 2017, 09:17:13 AM »
How are you extracting the files from rootfs{,64}.gz?

Using Corepure64 8.2:
Code: [Select]
$ cd /tmp/extract
$ zcat /tmp/rootfs64.gz | sudo cpio -i -H newc -d
$ ls -l opt
total 16
-rwxrwxr-x    1 root     staff           51 Sep 28 21:11 bootlocal.sh
-rwxrwxr-x    1 root     staff          272 Sep 28 21:11 bootsync.sh
-rwxrwxr-x    1 root     staff          613 Sep 28 21:11 shutdown.sh
-rw-rw-r--    1 root     staff           31 Sep 28 21:11 tcemirror

..and:
Code: [Select]
$ ls -l
total 4
drwxr-xr-x    2 root     root          1380 Sep 28 21:11 bin/
drwxrwxr-x    7 root     staff         2540 Sep 28 21:11 dev/
drwxr-xr-x    8 root     root           660 Sep 28 21:11 etc/
drwxrwxr-x    2 root     staff           40 Sep 28 21:11 home/
-rwxr-xr-x    1 root     root           496 Sep 28 21:11 init
drwxr-xr-x    4 root     root           840 Sep 28 21:11 lib/
lrwxrwxrwx    1 root     root            11 Sep 28 21:11 linuxrc -> bin/busybox
drwxrwxr-x    2 root     staff           40 Sep 28 21:11 mnt/
drwxrwsr-x    2 root     staff          160 Sep 28 21:11 opt/
drwxrwxr-x    2 root     staff           40 Sep 28 21:11 proc/
drwxrwxr-x    2 root     staff           80 Sep 28 21:11 root/
drwxrwxr-x    3 root     staff           60 Sep 28 21:11 run/
drwxr-xr-x    2 root     root          1200 Sep 28 21:11 sbin/
drwxrwxr-x    2 root     staff           40 Sep 28 21:11 sys/
drwxrwxrwt    2 root     staff           80 Sep 28 21:11 tmp/
drwxr-xr-x    7 root     root           140 Sep 28 21:11 usr/
drwxrwxr-x    8 root     staff          180 Sep 28 21:11 var/

Offline MSumulong

  • WikiUser
  • *
  • Posts: 24
Re: TCL 8.x rootfs.gz files all owned by root:root
« Reply #4 on: September 28, 2017, 09:48:16 AM »
I wasn't extracting the files, I was just using cpio -tvn to get a file listing of what's inside the archive.

However, I was able to confirm getting the same results as you did with rootfs64.gz but not with rootfs.gz (the x86 version). Using Tiny Core Linux 8.2 x86 rootfs.gz and the same commands you used for Corepure 64 8.2, I get the following results:

Code: [Select]
$ wget http://distro.ibiblio.org/tinycorelinux/8.x/x86/release/distribution_files/rootfs.gz
--2017-09-28 13:38:35--  http://distro.ibiblio.org/tinycorelinux/8.x/x86/release/distribution_files/rootfs.gz
Resolving distro.ibiblio.org (distro.ibiblio.org)... 152.19.134.43
Connecting to distro.ibiblio.org (distro.ibiblio.org)|152.19.134.43|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2526169 (2.4M) [application/x-gzip]
Saving to: ‘rootfs.gz’

rootfs.gz                                  100%[======================================================================================>]   2.41M   103KB/s    in 28s     

2017-09-28 13:39:04 (89.1 KB/s) - ‘rootfs.gz’ saved [2526169/2526169]

$ zcat rootfs.gz | sudo cpio -i -H newc -d
$ ls -l opt
total 48
-rwxrwxr-x 1 root root  51 Sep 28 13:41 bootlocal.sh
-rwxrwxr-x 1 root root 272 Sep 28 13:41 bootsync.sh
-rwxrwxr-x 1 root root 613 Sep 28 13:41 shutdown.sh
-rw-rw-r-- 1 root root  31 Sep 28 13:41 tcemirror

and also:

Code: [Select]
drwxr-xr-x 2 root root   12288 Sep 28 13:41 bin
drwxrwxr-x 7 root root   20480 Sep 28 13:41 dev
drwxr-xr-x 8 root root    4096 Sep 28 13:41 etc
drwxrwxr-x 2 root root    4096 Sep 28 13:41 home
-rwxr-xr-x 1 root root     496 Sep 28 13:41 init
drwxr-xr-x 4 root root    4096 Sep 28 13:41 lib
lrwxrwxrwx 1 root root      11 Sep 28 13:41 linuxrc -> bin/busybox
drwxrwxr-x 2 root root    4096 Sep 28 13:41 mnt
drwxrwsr-x 2 root root    4096 Sep 28 13:41 opt
drwxrwxr-x 2 root root    4096 Sep 28 13:41 proc
drwxrwxr-x 2 root root    4096 Sep 28 13:41 root
drwxrwxr-x 3 root root    4096 Sep 28 13:41 run
drwxr-xr-x 2 root root   12288 Sep 28 13:41 sbin
drwxrwxr-x 2 root root    4096 Sep 28 13:41 sys
drwxrwxrwt 2 root root    4096 Sep 28 13:41 tmp
drwxr-xr-x 7 root root    4096 Sep 28 13:41 usr
drwxrwxr-x 8 root root    4096 Sep 28 13:41 var

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 9633
Re: TCL 8.x rootfs.gz files all owned by root:root
« Reply #5 on: September 28, 2017, 10:40:55 AM »
OK, I see the same thing with rootfs.gz - this may have been due to a busybox cpio problem a while back.

I'll try to post a fixed version early next week.
« Last Edit: September 28, 2017, 10:45:22 AM by Juanito »

Offline hiro

  • Hero Member
  • *****
  • Posts: 1079
Re: TCL 8.x rootfs.gz files all owned by root:root
« Reply #6 on: September 28, 2017, 11:26:08 AM »
Thanks Juanito, I had to remaster before use (enable serial console in inittab), so I wasn't sure if it's just my cpio usage or a borked release.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 9633
Re: TCL 8.x rootfs.gz files all owned by root:root
« Reply #7 on: October 02, 2017, 07:05:45 AM »
Corrected rootfs.gz, etc posted.

Offline MSumulong

  • WikiUser
  • *
  • Posts: 24
Re: TCL 8.x rootfs.gz files all owned by root:root
« Reply #8 on: October 02, 2017, 01:17:22 PM »
Looks good, thanks Juanito!

Offline hiro

  • Hero Member
  • *****
  • Posts: 1079
Re: TCL 8.x rootfs.gz files all owned by root:root
« Reply #9 on: October 06, 2017, 07:10:02 AM »
I still get this from rootfs.gz
$ ls -la etc/sysconfig
total 4
drwxrwxr-x 2 root root  80 Oct  6 17:08 .
drwxr-xr-x 8 root root 660 Oct  6 17:08 ..
-rw-rw-r-- 1 root root   0 Oct  6 17:08 backup_device
-rw-r--r-- 1 root root  13 Oct  6 17:08 ntpserver

downloaded from http://tinycorelinux.net/8.x/x86/release/distribution_files/rootfs.gz

my steps were
gunzip rootfs.gz
mkdir root; cd root
sudo cpio -i < ../rootfs
« Last Edit: October 06, 2017, 07:11:53 AM by hiro »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 9633
Re: TCL 8.x rootfs.gz files all owned by root:root
« Reply #10 on: October 06, 2017, 07:26:24 AM »
By comparison to rootfs64.gz, backup_device should be root:staff, but ntpserver should be root:root.

It looks like the correction of the folders under /etc was missed, I'll take a look.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 9633
Re: TCL 8.x rootfs.gz files all owned by root:root
« Reply #11 on: October 06, 2017, 08:07:12 AM »
rootfs.gz reposted - hopefully I got them all this time...

Offline MSumulong

  • WikiUser
  • *
  • Posts: 24
Re: TCL 8.x rootfs.gz files all owned by root:root
« Reply #12 on: October 11, 2017, 11:43:10 AM »
Apologies, I may have spoken too soon. After looking into this in more detail, it looks like there are more files whose ownership needs to be changed in 8.2-x86 rootfs.gz:

Based on 7.x's rootfs.gz:

The following files are owned by root:staff

Code: [Select]
etc/init.d/dhcp.sh
etc/issue
etc/rpc
lib/modules
lib/udev/firmware.sh
lib/udev/pcmcia-check-broken-cis
lib/udev/pcmcia-socket-startup
lib/udev
sbin/autologin
sbin/ctty-hack
sbin/pccardctl
tmp/98-tc.rules
usr/bin/backup
usr/bin/bcrypt
usr/bin/chkonboot.sh
usr/bin/exittc
usr/bin/fromISOfile
usr/bin/provides.sh
usr/bin/seekWinPartition
usr/bin/sethostname
usr/bin/sudo
usr/bin/tcemirror.sh
usr/bin/tce-status
usr/bin/tce-update
usr/lib/libsysfs.so.2.0.1
usr/lib/sudo_noexec.so
usr/local/bin
usr/local/lib/modules
usr/local/lib
usr/local
usr/local/tce.installed
usr/sbin/cache-clear
usr/sbin/cd_dvd_symlinks.sh
usr/sbin/visudo
usr/share/doc/License/bsd.txt
usr/share/doc/License/gnufdl.txt
usr/share/doc/License/gplv2.txt
usr/share/doc/License/gplv3.txt
usr/share/doc/License
usr/share/doc
usr/share/doc/tc/bootOptions.txt
usr/share/doc/tc
usr/share/kmap
usr/share/kmap/us.kmap
usr/share/misc
usr/share/syslinux/pxelinux.0
usr/share/syslinux
usr/share/tabset
usr/share/tabset/stdcrt
usr/share/tabset/std
usr/share/tabset/vt100
usr/share/tabset/vt300
usr/share/terminfo/a/ansi
usr/share/terminfo/a
usr/share/terminfo/l/linux
usr/share/terminfo/l
usr/share/terminfo
usr/share/terminfo/r
usr/share/terminfo/r/rxvt
usr/share/terminfo/v
usr/share/terminfo/v/vt100
usr/share/terminfo/v/vt102+enq
usr/share/terminfo/v/vt102-nsgr
usr/share/terminfo/v/vt102
usr/share/terminfo/v/vt102-w
usr/share/terminfo/x
usr/share/terminfo/x/xterm-color
usr/share/terminfo/x/xterm-new
usr/share/terminfo/x/xterm
usr/share/terminfo/x/xterm-vt220
usr/share/udhcpc/default.script
usr/share/udhcpc


The following files are owned by mdc:staff

Code: [Select]
usr/bin/bbcheck.sh
usr/bin/bigHomeFiles.sh
usr/bin/calc
usr/bin/getdisklabel
usr/bin/history
usr/bin/showbootcodes
usr/bin/tce-run
usr/bin/text2lp0
usr/bin/uuid

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 9623
Re: TCL 8.x rootfs.gz files all owned by root:root
« Reply #13 on: October 11, 2017, 10:30:01 PM »
I checked the lists, and none of them need to be :staff; they just happened to be so before.
The only barriers that can stop you are the ones you create yourself.

Offline hiro

  • Hero Member
  • *****
  • Posts: 1079
Re: TCL 8.x rootfs.gz files all owned by root:root
« Reply #14 on: November 25, 2017, 05:57:42 PM »
for reference, might have something to do with this: http://forum.tinycorelinux.net/index.php/topic,20825.msg130244.html#msg130244