GB58e

          Is this a bug or feature? :-) *1

I. Reverse SSH
--------------

Build FreeBSD virtualBox guest machine as in part II of this paper.

1. From some guest behind NAT network:

     ssh -R 19999:localhost:22 opilane@172.18.11.111

   From Windows Host/Putty

     ssh opilane@172.18.11.111

   After the sucessful login to Source:

     ssh virtu@localhost -p 19999

* port 19999 can be any unused port.

Read this:

  https://www.howtoforge.com/reverse-ssh-tunneling

II. FreeBSD on Virtualbox prebuilt disk
---------------------------------------

  https://www.freebsd.org/where.html

  ftp://ftp.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/11.0-RELEASE
  /amd64/Latest/FreeBSD-11.0-RELEASE-amd64.vmdk.xz

1. Buid 1GB RAM FreeBSD x64 VM, extract and attach to IDE conroller downloaded HD image.

2. Login as root without password.

  root@:/usr/home/virtu # cd /etc
  root@:/etc # touch rc.conf
  root@:/etc # ls -l rc.conf
  -rw-r--r--  1 root  wheel  128 Nov  5 09:24 /etc/rc.conf
  root@:/etc # vi rc.conf
  hostname="MYHOST"
  ifconfig_em0="DHCP"
  sshd_enable="YES"
  # "AUTO" enables crash dumps, "NO" disables
  dumpdev="AUTO"

3. Reboot

  root@:/etc # init 6

4. Bootstrap pkg.

   Notes: 0. VirtualBox: !!! WORKS FOR NETWORK TYPE: BRIDGED ONLY !!!
             Virtualbox 5.1.8 has this bug too.*2
          1. ${ABI} stands for "FreeBSD:11:amd64" if ver.11 x64
          2. by default signature_type: "fingerprints"
          3. ..eebsd.org/${ABI}/quarterly/Latest/ provides older
             version of pkg

   In /etc/pkg/FreeBSD.conf

  url: pkg+http://pkg.freebsd.org/${ABI}/latest/Latest/
  signature_type: "none"

  # pkg
  # pkg2ng
  # pkg update

Read this:

>> FreeBSD has OpenSSH-server installed by default.
>> Enable it with sshd_enable=YES in rc.conf, and run
>>
>>   sh /etc/rc.d/sshd start
>>
>> http://serverfault.com/questions/90192/install-ssh2-server-on-freebsd

5. Create user

  # adduser        < virtu,.. invite: wheel,.. >
  # pw user mod virtu -G wheel
  # groups virtu
  virtu wheel

6. Login via ssh as virtu, $ su makes you root.

References
----------

*1) https://groups.google.com/forum/#!topic
    /mpc.lists.freebsd.questions/wCtgFmvmZPI

*2) http://stackoverflow.com/questions/40209220
         /freebsd-pkg-suddenly-stopped-bootstrapping

Annex A. pkg usage examples
---------------------------

  https://www.freebsd.org/cgi/man.cgi?pkg(7)

EXAMPLES
     Some examples are listed here.  The full list of available commands are
     available in pkg(8) once it is bootstrapped.

     Search for a package:
           $ pkg search perl

     Install a package:
           % pkg install perl

     List installed packages:
           $ pkg info

     Upgrade from remote repository:
           % pkg upgrade

     List non-automatic packages:
           $ pkg query -e '%a = 0' %o

     List automatic packages:
           $ pkg query -e '%a = 1' %o

     Delete an installed package:
           % pkg delete perl

     Remove unneeded dependencies:
           % pkg autoremove

     Change a package from automatic to non-automatic, which will prevent
     autoremove from removing it:
           % pkg set -A 0 perl

     Change a package from non-automatic to automatic, which will make
     autoremove allow it be removed once nothing depends on it:
           % pkg set -A 1 perl

     Create package file from an installed package:
           % pkg create -o /usr/ports/packages/All perl

     Determine which package installed a file:
           $ pkg which /usr/local/bin/perl

     Audit installed packages for security advisories:
           $ pkg audit

     Check installed packages for checksum mismatches:
           # pkg check -s -a

     Check for missing dependencies:
           # pkg check -d -a
