Page 1 of 1

[SOLVED] How to replace guest with demo user account?

Posted: 16 Jul 2011, 20:25
by Syntux
I would like to create a module to replace the guest user with a demo user. Can anybody tell me where to look and what to change?
I could also imagine to just add a demo user and start Porteus and X11 with the demo account instead of guest?
Where do I need to look for starting up Porteus with a different user, e.g. demo?

Re: How to replace guest with demo user account?

Posted: 17 Jul 2011, 13:29
by fanthom
hi Syntux,

i have prepared a quick script for Porteus-1.0 which does all the things automatically.

WARNING: this script saves copy of important system files (ie. /etc/rc.d/*) and cant be used on other versions of Porteus

Code: Select all

#!/bin/sh

# variables
wrk=/tmp/user_switcher

# cleanup
clear
[ -d "$wrk" ] && rm -r $wrk
mkdir $wrk

# let's start
echo "please provide a name of the user which gonna replace standard "guest" account"
read user

# tweaking global system settings
for x in "
/etc/group
/etc/passwd
/etc/shadow
/etc/rc.d/rc.4
/etc/rc.d/rc.M
/opt/porteus-scripts/magic_folders
/opt/porteus-scripts/xporteus-settings-assistant
/usr/doc/Porteus-FAQ.html
/etc/lxdm/lxdm.conf
"
do
    cp --parents $x $wrk
done

for x in `find $wrk -type f`; do sed -i $x -e s/guest/$user/g; done

# tweaking user settings
cp -r --parents /home/guest $wrk 2>/dev/null
for x in `find $wrk/home/guest -type f`; do sed -i $x -e s/guest/$user/g; done

# changing password
mv /etc/group /etc/group.backup
mv /etc/passwd /etc/passwd.backup
mv /etc/shadow /etc/shadow.backup
cp $wrk/etc/group $wrk/etc/passwd $wrk/etc/shadow /etc
echo
passwd $user
mv $wrk/home/guest $wrk/home/$user
chown -R $user:$user $wrk/home/$user
cp /etc/shadow $wrk/etc
mv /etc/group.backup /etc/group
mv /etc/passwd.backup /etc/passwd
mv /etc/shadow.backup /etc/shadow

# creating final module
dir2xzm $wrk /root/Desktop/$user-account-Porteus-1.0-x86_64.xzm >/dev/null

echo
echo "all required files have been tweaked and gathered in one xzm module placed on root's desktop: /root/Desktop/$user-account-Porteus-1.0-x86_64.xzm"
echo "/etc/issue
/usr/share/lxdm/themes/Industrial/wave.svg
/usr/share/apps/kdm/themes/EOSMania/isadora.jpg
still contains login details for 'guest' account, these files must be tweaked manually if needed"
echo "press enter to exit..."
read
if you want to get rid of "guest" account completely then you'll have to remaster 001,002,003,004 and firefox xzm module and remove /home/guest folder from each. dont forget about 3 files mentioned at the end.

Cheers

Re: How to replace guest with demo user account?

Posted: 18 Jul 2011, 02:18
by Syntux
Hi fanthom,

Wow! This is more than I expected and probably better than any explanation by words ;)
I wish I could be that fast in scripting as you :)

Thanx a lot,
Syntux