1

I need a way to create an account that will delete itself when the system does a full poweroff, but not on a reboot or logout. It also needs to have a unique account name (not guest) and password.

1 Answer 1

2
sudo adduser newuser

It will ask for password of newuser.

Create a bash script, for example: deleteuser.sh

Script:

#!/bin/sh
deluser --remove-all-files newuser

To execute a script at shutdown

  • Put your script in /etc/rc0.d
  • Make it executable (sudo chmod +x deleteuser.sh)
  • Note: The scripts in this directory are executed in alphabetical order
4
  • Good one, but I would have asked an additional question: what needs to be done with the files that the user created? and then do a --delete-home or --delete-allfiles (or maybe nothing like you proposed!) ;-)
    – Fabby
    Jan 31, 2015 at 4:29
  • @Fabby I updated answer. Thx! Jan 31, 2015 at 4:36
  • I made a correction in answer. Dİrectory should be /etc/rc0.d Jan 31, 2015 at 5:42
  • I actually just discovered that there are some rather stringent naming conventions for scripts in the run level folders. Specifically, they are required to start with 'K99' and not have an extension. Could you update your answer with these to save future readers a little frustration?
    – Imtnt
    Feb 2, 2015 at 18:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .