Dear "tinycorers".
I' ve found some errors in TCL Wiki, page TinyCore Passwords (
http://wiki.tinycorelinux.net/wiki:passwd):
1) I've added users, groups, and add passwords for tc, root and new users.
2) Following these instructions in wiki, I've edited shutdown.sh and bootsync.sh for persistent opt:
.......
Save Passwords using Persistent opt
If you use persistent opt, open the terminal and type
sudo cp /etc/shadow /opt/shadow
Add the following to /opt/bootsync.sh
sudo mv /etc/shadow /etc/shadow_old
sudo cp /opt/shadow /etc/shadow
Note that this will apply group staff and mode g+w to /opt/shadow on each boot, as it's the case with every file in /opt.
........
Editing:
1)
My shutdown.sh:
#!/bin/busybox ash
. /etc/init.d/tc-functions
useBusybox
# put user shutdown commands here
# saving users, groups and passwords...
sudo cp /etc/passwd /opt/passwd
sudo cp /etc/shadow /opt/shadow
sudo cp /etc/group /opt/group
sudo cp /etc/gshadow /opt/gshadow
# If no backup of home was done then loop through valid users to clean up.
if [ ! -e /tmp/backup_done ] || ! grep -q "^home" /opt/.filetool.lst; then
awk 'BEGIN { FS=":" } $3 >= 1000 && $1 != "nobody" { print $1 }' /etc/passwd > /tmp/users
while read U; do
while read F; do
TARGET="/home/${U}/$F"
if [ -d "$TARGET" ]; then
rm -rf "$TARGET"
else
if [ -f "$TARGET" ]; then
rm -f "$TARGET"
fi
fi
done < /opt/.xfiletool.lst
done < /tmp/users
fi
2)
My bootsync.sh following wiki procedures (IT FAILS!!!):
#!/bin/sh
# put other system startup commands here, the boot process will wait until they complete.
# Use bootlocal.sh for system startup commands that can run in the background
# and therefore not slow down the boot process.
/usr/bin/sethostname TCL
# recovering users, groups and passwords...
sudo mv /etc/passwd /etc/passwd_old
sudo cp /opt/passwd /etc/passwd
sudo mv /etc/shadow /etc/shadow_old
sudo cp /opt/shadow /etc/shadow
sudo mv /etc/group /etc/group_old
sudo cp /opt/group /etc/group
sudo mv /etc/gshadow /etc/gshadow_old
sudo cp /opt/gshadow /etc/gshadow
/opt/bootlocal.sh &
3)
Rebooting:
Near the end of boot messages (no quiet bootcode):
..................
..................
sudo: unknown uid: 0
sudo: unknown uid: 0
sudo: unknown uid: 0
sudo: unknown uid: 0
sudo: unknown uid: 0
sudo: unknown uid: 0
sudo: unknown uid: 0
sudo: unknown uid: 0
One message for each sudo command in bootsync.sh.
??
Evidently, at this stage, root privileges for sudo are not set yet (may be are set later in boot process? When?).
.................
After this, in sh login screen, no users other than tc or root are recognized, nor saved passwords are allowed.
Therefore, if there is a "noautologin" bootcode in extlinux.conf, nor tc nor root can not login in system.
BTW: I don't know if tc and root have a public initial password in TCL (CD, PPR).
passwd, shadow, group and gshadow files in /etc directory remains as in base system.
But passwd, shadow, group and gshadow files in /mnt/sda1/opt directory are OK!
....................................................................
FIXING CODE FOR A MULTI-USER TCL:
My new bootsync.sh:
#!/bin/sh
# put other system startup commands here, the boot process will wait until they complete.
# Use bootlocal.sh for system startup commands that can run in the background
# and therefore not slow down the boot process.
/usr/bin/sethostname TCL
# recovering users, groups and passwords...
/bin/mv /etc/passwd /etc/passwd_old
/bin/cp /opt/passwd /etc/passwd
/bin/mv /etc/shadow /etc/shadow_old
/bin/cp /opt/shadow /etc/shadow
/bin/mv /etc/group /etc/group_old
/bin/cp /opt/group /etc/group
/bin/mv /etc/gshadow /etc/gshadow_old
/bin/cp /opt/gshadow /etc/gshadow
/opt/bootlocal.sh &
OK!!! IT WORKS!!!
SOLVED!!!
IMHO, editing the wiki page is absolutely necessary.
Wrong instructions can result in serious errors, and new users may consider TCL as unreliable system...
Best regards,
DanielH
P.S.: I apologize for my bad english...