[Server-devel] unregister soas

Devon Connolly devcon at gmail.com
Sat Oct 17 19:13:30 EDT 2009


Save the following script to /home/idmgr as something like  
remove_all_users:

______________________________________

#!/bin/sh
##LIST ALL SERIAL NUMBERS##
sqlite3 /home/idmgr/identity.db "SELECT serial FROM laptops" > dellist.txt

##DELETE ALL ACCOUNTS IN LIST##
for serial in $(< dellist.txt); do
     echo "$serial" | grep -s -E '^[A-Z]{3}[A-F0-9]{8}$' || exit 1
     sqlite3 /home/idmgr/identity.db "DELETE FROM laptops WHERE serial =  
'$serial'" || exit 1
     /usr/sbin/userdel -r $serial
done

______________________________________

Don't forget to make it executable... Again, remove the '-r' option if you  
don't want to delete the users files.

# chmod +x /home/idmgr/remove_all_users

Cleaning up the moodle database should be similarly simple.


> # su - postgres
> # psql
> # \connect moodle-xs
> # DELETE FROM mdl_user;

If you use the admin account, be careful not to delete it.  You can always  
just make another one after though.


On Sat, 17 Oct 2009 19:37:12 -0000, David Leeming  
<david at leeming-consulting.com> wrote:

> Is there a way to delete all users from the XS? I.e. I have upgraded from
> 0.5.2 and wish to start afresh with a "clean" upgrade.
>
>
>
> David Leeming
> Solomon Islands Rural Link
> http://www.leeming-consulting.com
>
> -----Original Message-----
> From: server-devel-bounces at lists.laptop.org
> [mailto:server-devel-bounces at lists.laptop.org] On Behalf Of Devon  
> Connolly
> Sent: Sunday, 18 October 2009 5:13 a.m.
> To: server-devel at lists.laptop.org
> Subject: Re: [Server-devel] unregister soas
>
> With the latest XO build you need to:
>
> # rm .sugar/default/config
>
> Then press CTL+ALT+ERASE.  You will need to re-enter the students name  
> and
> the register option will have returned.
>
>  From what I've experienced "sugar-control-panel -c registration" only
> seems to allow laptops that were having trouble registering register.  If
> they are already registered, I don't think it does anything.
>
> To clear the server of all history of the registration:
>
> # /home/idmgr/remove_user "SERIAL#"
>
> This will delete the user from the registration sqlite database.  It also
> deletes the user account fromt he server.  I modified the script so it
> also deletes the users backup files...
>
> /home/idmgr/remove_user
> _______________________________________________
>
> #!/bin/sh
>
> for serial; do
>      echo "$serial" | grep -s -E '^[A-Z]{3}[A-F0-9]{8}$' || exit 1
>      sqlite3 /home/idmgr/identity.db "DELETE FROM laptops WHERE serial =
> '$serial'" || exit 1
>      /usr/sbin/userdel -r $serial
> done
> _______________________________________________
>
> Take away the '-r' option from userdel to refrain from deleting the users
> files.
>
> When deleting the users from Moodle, they should be just marked deleted
> but are not removed from the Moodle database.  To get rid of them you  
> need
> to:
>
> ______________________________________________________
> # su - postgres
> # psql
> # \connect moodle-xs
> # DELETE FROM mdl_user WHERE mdl_user.deleted = 1;   //To delete all  
> users
> that were deleted from the moodle interface.
> # DELETE FROM mdl_user WHERE mdl_user.username = 'USERSNAME';  //To  
> delete
> a specific user
> # \quit
> _______________________________________________________
>
> I believe the above removes all traces from the server.
>
> On Sat, 17 Oct 2009 15:41:30 -0000, Tim Moody <timmoody at sympatico.ca>
> wrote:
>
>> Is there a way to unregister a client with the xs?
>>
>> sugar-control-panel -c register didn't seem to do anything.
>> _______________________________________________
>> Server-devel mailing list
>> Server-devel at lists.laptop.org
>> http://lists.laptop.org/listinfo/server-devel
>
>
>
> _______________________________________________
> Server-devel mailing list
> Server-devel at lists.laptop.org
> http://lists.laptop.org/listinfo/server-devel
>
>
>


-- 

Devon Connolly


More information about the Server-devel mailing list