Solved Use my own password when logging into root via su?

I'm new to FreeBSD and running 10.2 in a VirtualBox VM. I've added my username to the wheel group as documented here. Is there a way to log into root using su by supplying my own password (i.e. instead of providing the root password)?
 
If you're just trying to avoid using the root password, you could install sudo and use it instead of su. Here's what I do for new installs (although I'm new to BSD and I hope someone corrects me if this is wrong).

Code:
# su
<enter root password>
# pkg update
# pkg install sudo

After sudo is installed, you'll need to edit the configuration using visudo(8) to uncomment the first "wheel" line, which looks like this:
Code:
## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL

# visudo
  1. Use /# %wheel to find the line that contains # %wheel ALL=(ALL) ALL.
  2. Hit x key twice to delete the # comment character and the space.
  3. Hit esc then :wq to save and exit.
Back in the terminal, use exit to log out of the root user and then use sudo to run commands as root using your user password.
 
Last edited by a moderator:
Personally, I do not like sudo(8). This may be because I am mainly accessing my FreeBSD and Linux systems by sshing into them, and becoming root as needed with su. The implication is that having to know the system password in addition to a user password is at least an additional hurdle. I can understand not caring about this behavior if you are not allowing network logins, anyway.
 
Last edited by a moderator:
Back
Top