Protecting data on shared linux ubuntu laptop

Posted on 2011-05-07
Last Modified: 2012-05-11
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.
Question by:tmonteit
    LVL 40

    Expert Comment

    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.
    LVL 38

    Accepted Solution

    > 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 ]
       touch ~/.login_time
       date +%s > ~/.login_time

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


    FIRST_LOGIN_TIME=`cat ~/.login_time`
    CURRENT_TIME=`date +%s`

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

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

    4. Make sure the crond is running at boot time....
    LVL 38

    Expert Comment

    Woo, typo

    # check if the time spend from the first login time greater than 86400 seconds
    if [ "$TIME_DIFF" -gt "86400" ]     # <== this line
       /bin/rm -rf  $DIR_TO_CLEAN
    LVL 3

    Expert Comment

    use cron with :

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

    Put cron for specific date and time :
    LVL 76

    Expert Comment

    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)

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
    Join Greg Farro and Ethan Banks from Packet Pushers ( and Greg Ross from Paessler ( for a discussion about smart network …
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now