-1

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.

lss111
  • 19
  • 2
  • 2
    `sudo` uses your user's password. `su` requires the password of the user you are becoming. What about using `sudo` for this isn't working? – Etan Reisner Mar 19 '15 at 15:07
  • I don't know why sudo chmod 777 /data/db it isn't working. I get a long error message. I think this is the relevant part '015-03-19T07:59:03.345-0700 I CONTROL [initandlisten] couldn't open /data/db/journal/j._0 errno:13 Permission denied' – lss111 Mar 19 '15 at 15:09
  • @lss111 - Use backticks in comments to format code. For example, \`code\` becomes `code`. – Mr. Llama Mar 19 '15 at 15:11
  • 1
    Get the entire error output and put in in the post formatted as code. Also `777` is a **horrible** permission to set on anything just about ever. If those are official directions that's horrifying. – Etan Reisner Mar 19 '15 at 15:27

1 Answers1

0

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.

Pétur Ingi Egilsson
  • 4,368
  • 5
  • 44
  • 72