Today i logged in with my user name and password to manjaro.this user is also admin.
Then i opend terminal and have to use sudo command.
Password wasn’t accepted, despite the password is correct. After that i did this
sudo -su
In this case my password was accepted
Then i done this
passwd
the system asked me to set password. So i set again the same password. Now sudo command is working.
But i don’t get why my password wasn’t accepted, i mean i could log in with password but coudn’t use it for sudo command?
I think you remember the train chain of events incorrectly.
will throw a syntax error, not ask for a password
In any case: after you now changed/re-set the password
no one can hope to ever truly find out why it wasn’t working before.
Speculation is all that remains … and the top contender is that you mistyped, just as you did with the command above …
Oh well.
For example, you did mistype the command above, the one you said you used to get root to change the password.
And, after the fact, after the correction, finding the cause is … impossible.
Mere speculation.
… except when you want to invest the time and work
and have a backup of the state before -
and restore to that state and investigate
You can revisit what commands you typed by looking at your shell history.
the command for it is: history
or - to be able to scroll through what may be a hundreds of lines long list: less ~/.bash_history if your shell is Bash
su and sudo are similar in function, but not the same
If sudo does not work (because you don’t know the password, for example), then sudo su
will not work either
su
might work - but only if you have actually set up a password for the root user