I have two accounts on my computer: james and john. james is the only administrative account and a few days ago I set it to expire out of curiosity. Now am stuck. I can not login using james because it has expired, I can not use john for anything because it is not a member of sudoers. I can not login as root probably because root and james shared a password.
Root account expired
root
Related Solutions
Every account on a Unix/Linux system has a numeric identifier, the "user ID" or UID. By convention, UID 0 (zero) is named "root", and is given special privileges (generally, the permission to access anything on the system).
You could just log in as the root user directly, if you have the root password. However, it's generally considered bad practice to do so.
For one thing, it's often the case that Unix/Linux gives you plenty of room to shoot yourself in the foot with no safety — there are many typos and accidents from which the easiest recovery is to do a complete reinstall and/or restore from backup. So, having to actually switch to root when you need to keeps you from accidentally doing something you didn't mean to.
It also helps limit the spread of malware. If your web browser is running under UID 0 — "as root", we say — then a programming bug could be exploited by remote websites to take complete control over your computer. Keeping to a "regular" user account limits that damage.
Both of these follow a general best practice called "the principle of least privilege" — which, honestly, is a good thing to follow in system design in general. You can read more in specific about reasons to not always run as root under Concern about logging in as root overrated?
Now, that leaves the question of how you can get access to protected things as a non-root user. There are two basic ways — su
and sudo
. The first requires the root password, and the second, in usual configuration, requires your password. It's often the case that you use sudo
to run a single command "as root", rather than switching to the root account for a whole session. (You can also do this with su -c
, something you will often see in documentation.) For a long discussion of the relative merits of these, see Which is the safest way to get root privileges: sudo, su or login?. (And, for completeness, there are other mechanisms which aren't sudo but work in the same way, like PackageKit, usually used for GUI applications.)
You ask whether the terms "root", "superuser", and "administrator" are the same. "Root" and "superuser" basically are. To be precise, one might say: "The root
account is the superuser, because it has UID 0."
"Administrator" could mean the same thing, but in Fedora, we* use it in a slightly different way. Not every user on the system has the power to get root privileges via sudo. In Fedora in the default setup, members of the group wheel
can do this. And, in the installer and in the documentation and other places, we call this an "administrator account". One that isn't root, but has the power to access root privileges.
(Oh, and one final thing: that #
vs $
in your prompt is just a visual convention and isn't definitive. You can change the environment variable PS1
to make the prompt do all sorts of things.)
* I work on Fedora.
By default Debian/Ubuntu/Mint has a user with administrative accesses, namely used to shutdown MySQL, called debian-sys-maint
.
Go to the file /etc/mysql/debian.cnf
which has as the format:
[client]
host = localhost
user = debian-sys-maint
password = XXXXXXXX
socket = /var/run/mysqld/mysqld.sock
Take from there the password, that is randomly generated when installing MySQL (e.g. it differs between servers);
And login into your MySQL with:
mysql -udebian-sys-maint -pXXXXXXXX
After that, you can change your root password.
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');
Be aware that this changed slightly in MySQL 5.7. Have a look at How to change MySQL 'root' password using MySQL v5.7?
Best Answer
Just turn off the computer , use another live system , e.g liveCD ,
Boot and chroot , change the password and expire time.