This may come as a shock if you’re new to Mac and ever used a *nix system before.. but the sudo password, is your password! If you’re administrator anyway, if not, ask your *rents, instructor or local admin to help you out. 😉
/etc/sudoers contains the permissions for who can use it, and once you have it, it is very powerful indeed.
If for any reason you need to have access to the full root account, this is actually not enabled on a Mac by default, for good reason.
To Enable Root User (see Apple KB below for reference):
1) From the Apple menu choose System Preferences….
2) From the View menu choose Accounts.
3) Click on the lock and authenticate with an administrator account.
4) Click Login Options….
5) Click the “Edit…” or “Join…” button at the bottom right.
6) Click the “Open Directory Utility…” button.
7) Click the lock in the Directory Utility window.
8) Enter an administrator account name and password, then click OK.
9) Choose Enable Root User from the Edit menu.
10) Enter the root password you wish to use in both the Password and Verify fields, then click OK.
After writing multiple articles on a single subject, I decided to consolidate the links into a single point of reference. All links below are internal to my site and do not redirect outside of my blog.
(Tested on 10.6 Leopard.)
enable root user, or mac sudo password and settings, https://ronniediaz.com/2011/04/14/mac-sudo-password/
install macports and/or issues with install and configuring, https://ronniediaz.com/2011/04/14/no-indexes-found-sync-your-source-ports
converting iso images with bchunk, (discussed in my article on creating hybrid discs with toast), https://ronniediaz.com/2011/04/14/convert-toast-bin-to-iso-in-mac-os-x
open textedit from command line, https://ronniediaz.com/2011/04/14/open-textedit-from-command-line-on-mac-os-x-10-6-leopard/
vi keyboard shortcuts Quick Reference, https://ronniediaz.com/2011/04/14/vi-keyboard-shortcuts-quick-reference/
I found other articles online which mention editing ~/.bash.rc and ~./bash_profile but these are more work than necessary.
open -e [filename]
However, I noticed this functionality has some limitations concerning the files edited.
After trying the following commands on a secure file, it still would not save after making changes.
sudo open -e [filename] sudo chmod 777 [filename] sudo open -e [filename] sudo chown -R [currentusershortname]:staff [filename] sudo open -e [filename] su open -e [filename]
If you run into this issue where you cannot save after opening the file or any others with TextEdit, an awesome alternative and what I ultimately used is the tried and true vi.
See my “vi keyboard shortcuts quick reference” article for more info.
vi keyboard shortcuts quick reference, https://ronniediaz.com/2011/04/14/vi-keyboard-shortcuts-quick-reference