I'm running OpenBSD 5.7 on VirtualBox on my Windows 7, to learn more about Unix, but I can't use sudo
with my password. I've set up a user called adminvpn
but when I try to run any command using sudo
it tells that my password is wrong!
I have already tried my root password and my user password and I'm 100% sure they are correct and they are only letters… I have reinstalled OpenBSD 3 times and this is driving me crazy.
When I try to use my password for "adminvpn" I get
adminvpn is not in the sudoers file. This incident will be reported.
I'm able to log in with root and using my root password. I'm almost giving up to running it with a user.
Best Answer
The error message tells you what is wrong even if it doesn't tell you exactly how to fix it.
sudo
lets you run commands as the administrator. In order to be able to use sudo, you need to be made an administrator. Accounts are not made administrators by default.Run the command
visudo
(as root, of course) and add a line like the following:Save the file and exit. You can now run any command as root with
sudo
.Note that
visudo
will run your favorite editor, as indicated by the environment variableVISUAL
. If you haven't configured that, you'll get vi. If you're uncomfortable with vi, install another editor (e.g.pkg_add nano
) and add a line likeexport VISUAL=nano
to~/.profile
; run the command in your interactive shell as well for it to take effect in the current session.Unless configured otherwise,
sudo
requires you to type your own password. Knowledge of the root password is not necessary, that's the point of sudo`. The point of typing your password is to make sure it isn't someone else typing while you left your keyboard unattended.By the way, OpenBSD isn't the most beginner-friendly unix out there. If you want a gentler learning curve, try Ubuntu.