• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 378
  • Last Modified:

Protecting data on shared linux ubuntu laptop

I have share a laptop to test a custom application.  I will not have physical control of the machine and I'm uncertain what will happen to the laptop after the test.   My application is completely stored and run under a user directory.   Since, I'm not sure that I will get the laptop back after the test, is there a way to have the machine automatically purge my application after a certain time?  

For example:  All works fine for the first 24 hours, and then the app is deleted.
0
tmonteit
Asked:
tmonteit
1 Solution
 
mrjoltcolaCommented:
You don't have physical control of the laptop before the test either? If you never have physical control, you'd be forced to work within the confines of application domain (user space). So of course you could write some sort of watchdog app to remove itself after 24 hours. For more info on that option, you need to specify which language / environment you are using.
 
0
 
wesly_chenCommented:
> All works fine for the first 24 hours, and then the app is deleted.
1. record the first login time
edit your ~/.profile and add
------
if [ -s ~/.login_time ]
then
   touch ~/.login_time
else
   date +%s > ~/.login_time
fi

2. a shell script to check the first login time and delte the directory after 24 hours.
--- ~/bin/cleanup.sh ---
#!/bin/bash

DIR_TO_CLEAN=/path-to-the-app

FIRST_LOGIN_TIME=`cat ~/.login_time`
CURRENT_TIME=`date +%s`
TIME_DIFF=`expr $CURRENT_TIME - $FIRST_LOGIN_TIME`

# check if the time spend from the first login time greater than 86400 seconds
if [ "$TIME_DIFF" -gt "86400 ]
then
   /bin/rm -rf  $DIR_TO_CLEAN
fi
------
chmod +x
~/bin/cleanup.sh

3. Set up the cron job to run the script every 5 minutes
*/5 * * * * /home/<username>/bin/cleanup.sh > /dev/null 2>&1

4. Make sure the crond is running at boot time....
0
 
wesly_chenCommented:
Woo, typo

# check if the time spend from the first login time greater than 86400 seconds
if [ "$TIME_DIFF" -gt "86400" ]     # <== this line
then
   /bin/rm -rf  $DIR_TO_CLEAN
fi
0
 
Abhishek_ChibCommented:
use cron with :

find /path/to/files* -mtime +1 -exec rm {} \;

Put cron for specific date and time :

http://en.wikipedia.org/wiki/Cron
0
 
arnoldCommented:
Control the environment, which means bring your own laptop to demonstrate the application and then you either install it on their laptop/system after they decide to purchase it and then you can demonstrate that it is functional at the time (for the second time)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now