Tue Nov 01, 2016 7:57 pm
It's not clear from your post what you are trying to do, or what you have done.
First, the two commands you quoted do two entirely different things on the Pi.
"sudo passwd" will set or change the password for user root
"sudo raspi-config" will change the password for user pi
By default, Raspbian does not set a password for user root, therefor a user cannot log in as root. This is a security feature.
If you then run "sudo passwd", you will be prompted to set a password for root. Once you have done this, you may log in as user root with the password you have just set.
"sudo raspi-config" allows you to set the default password for user pi from "raspberry" to one of your own choosing. This is a very good idea, it prevents anybody else from logging into your Pi. You can do the same thing in the terminal with the "passwd" command, note that 'sudo' is not used here.
By default on Raspbian, the user pi has sudo privileges. Also by default on Raspbian, the user pi is not required to enter pi's password when using sudo. This is different from some other Linux distros, and is why you are not being asked for a password when using 'sudo'.
You can change this behavior by editing the file '/etc/sudoers.d/010_pi-nopasswd. Open the file and change the word "nopasswd" to "passwd". It is not necessary to change the name of the file (as far as I know).
On versions of Raspbian dated before about the 20th of Oct, 2016, the file '/etc/sudoers.d/010_pi-nopasswd' will not exist!
If this is the case, it will be necessary to edit the 'sudoers' file. You do this with the "sudo visudoers" command. This will open the file in the default text editor, but more importantly will prevent you from saving the edited file with a syntax error in it. An incorrect sudoers file can prevent your Pi from booting.
In the sudoers file, find the line "pi ALL=(ALL) NOPASSWD: ALL", and change 'NOPASSWD' to 'PASSWD'. Leave the rest of the file as is.
I recommend that you do change the user pi's password from the default, as explained above.
I recommend that you do not set a root password or change the sudo settings unless you have some experience of Linux administration and have a good reason to do so. Changing theses settings can make your Pi unbootable and cause loss of data. Just log in as pi, or set up another normal user account if you wish, and use 'sudo' when you need to run a command or program as root.
Hope this helps,
Dave.