Is there any way to prevent others including root account from resetting a user password? I'd like to protect my user account not to be logged in by others so that others can't see the mounted encrypted folder.
No, you cannot prevent
root from changing your password. The
root user has full control of the system, and if someone can log in as
root, they can change your password. Likewise, if another user has access to
sudo, you cannot prevent them from changing your password.
You can protect your data by encrypting your home folder. Users who can use
sudo (or log in as
root) could still change your password, but would not be able to access your data after changing it.
To secure the computer from
root or other users, you need root access yourself. If you own the computer you should consider:
- disabling the root user (or setting a password only you know)
- ensuring other users cannot use
- limiting physical access to the machine when possible
- encrypting the hard drive (usually requires reinstalling Ubuntu).