- Exit the current user session. Login as root.
$ exit
Login: root
Password: <password>
# pw group mod wheel -m <username>
- If possible, cleanly halt the file system.
$ shutdown -h now
-
Boot into Single User mode.
-
Enable write permissions on
/
.
# mount -u /
- Cleanly halt the system.
# shutdown -h now
- Boot into normal multiuser mode.
- Launch the Virtual Switch Manager from the Hyper V Manager.
- Add a New Virtual Network Switch. Type: External.
- For the external network, select the device that physically connects the host to the network, such as a wireless card or Ethernet adapter.
- Select an appropriate name.
- Select OK.
- Navigate to the FreeBSD VM Settings.
- In the Network Adapter section, select the named virtual switch.
- Select OK.
After a few seconds, a running FreeBSD VM will populate with DHCP records, allowing ping google.com
to succeed, for example.
If necessary, use ifconfig <network interface> down && ifconfig <network interface> up && dhclient <network interface>
to reload the connection, or use shutdown -h now
to cleanly reboot.
Note: Some instances may require a configuration tweak to work around an issue with ARP, especially wireless adapters:
$ su -
<root password>
# sysctl net.link.ether.inet.max_age=60
- Install the
sudo
package.
$ su -
<root password>
# pkg update && pkg install -y sudo
- Modify the sudoers configuration to allow sudo access by a specific account.
$ su -
<root password>
# vi /usr/local/etc/sudoers
Enter Insert mode by pressing i
.
Insert the line <username> ALL=(ALL) ALL
. For example, for user andrew
, insert the line:
andrew ALL=(ALL) ALL
Or, if desired, insert the line %<group> ALL=(ALL) ALL
. For example, for the wheel
group, insert the line:
%wheel ALL=(ALL) ALL
Then force save and exit.
(ESCAPE)
:w!
:q
- Exit the root session. Exit the current user session. Reenter the user session.
# exit
$ exit
Login: <username>
Now try sudo pkg update
and enter the current user password.