Artificial intelligent assistant

How to prevent a new user to inherit the files of a deleted user? I just deleted a user with "userdel", without deleting its home dir. Right after the deletion, I created a new user, with its own home dir. What striked me as odd, was that the new user gets the UID of the deleted user (the last UID, incremented by 1). Consequently, the new user also has ownership and full permissions on the files of the deleted user! Is this normal behaviour? Is there a best practice on how to prevent this, short of specifying a UID each time when creating a new user? (Tested on Linux Mint 17 and verified on OpenSuse 13.1)

If you delete the user account, then the user no longer exists. It's perfectly normal that the user ID then gets reused: there is nothing to distinguish this user ID from any other unused user ID.

If the account still owns files, the account still exists, so you need to keep it around. Don't delete the entry in the user database, mark it as disabled. On Linux:


usermod --expiredate 1 --lock --shell /dev/null


When you're sure you want to delete the account, first make sure that you've deleted every file that belongs to it (`find -user` may help). _Then_ delete the account with `userdel`.

If the user has a dedicated group, remember to delete it as well.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 32d9ec4dc53cef5799aef599352a7ab3