I try to check whether my root has password or not.
I run this command;
sudo passwd root
Later on it responses as;
Enter new UNIX password:
Based on that response, I have an indication that my root has no password. Therefore I want to quit from the command process.
How can I do that, please?
To view if your root has a password set use:
This will print out a:
P
in the second column if it has a password;L
in the second column if it has a locked password (a password which is impossible to type in) andL
is the default on Ubuntu;NP
if it has no password.To get out of the new password dialog just type wrong passwords: Type a new password and when asked for confirmation for this new password type a different password. The passwords will not match and the program exits with an appropriate error message.
(You can't use signals to quit, because
passwd
ignores every signal. Except SIGKILL should work, but it is unnecessary and maybe insecure to use here.)No. Since your admin is the one changing the password the current password is not asked. Otherwise changing a password for an account would require asking the user for his/her password.
Check
/etc/shadow
. Those files tell you if a user has a password and what encryption is used.The colums in
/etc/shadow
are :-seperated and indicate:===
See: http://linux.die.net/man/5/shadow If the password field contains some string that is not a valid result of crypt(3), for instance ! or *, the user will not be able to use a unix password to log in (but the user may log in the system by other means). ... A password field which starts with a exclamation mark means that the password is locked. The remaining characters on the line represent the password field before the password was locked.
===
control-x
It will show something like "[1]+ Stopped sudo passwd"
To escape a command running in a bash terminal use
Ctrl-C
.