Search code examples
bashunixsudosu

sudo password vs su password


My password for sudo commands works on my Mac, but it doesn't work for su? How can I reset (or find) my su password?

I ask because I need to make my /data/db directory readable/writable for installing MongoDB and my sudo command isn't doing the trick. I was told to use su chmod 777 /data/db but the password is different from my sudo password.


Solution

  • sudo -s to get root, then passwd to change the root password. There might not be need to change the root password in your case; you can paste that command in after obtaining root via sudo -s.