Setting Up SSH And Shared Folders in A RHEL VirtualBox VM
I discovered recently that RHEL has a free developer license, something that could have saved me a lot of trouble if I'd known it earlier. Since I do a lot of work in RHEL I've wanted to have a virtual environment that mimics it - I had been working in WSL, but I think having to work with VirtualBox VM does a better job of replicating the experience of working on it in production.
You'll need to get a RHEL Developer License to download the necessary ISO image. You can pretty much roll with the default settings while creating the VM, but two slightly trickier things for me were being able to ssh into the VM and get read-write access from the VM to a folder on my host machine.
Mounting a Shared Folder
To get a shared folder to mount, you need to "Insert the Guest Additions CD Image" with your VM running - apparently this is required for access to host folders and RHEL doesn't have this functionality enabled by default.

Once this is done, you may need to restart the machine, but you should be able to mount a shared folder to your destination of choice:

This will create a vboxsf
group that gets ownership over shared folders: make sure to sudo usermod -aG vboxsf {my_username}
so you can access them.
Setting Up SSH Access
Change your VM's network settings to "Bridged Adapter".

Get your IP address with ifconfig -a
: it should be right beside the first inet
value.
Create a key on your local machine:
ssh_keygen
Make sure to sudo chmod 600 {keyfile}
- the default permissions are too open and will be ignored by your VM.
If you so desire, add it to ~/.ssh/config
:
Host rheldev
HostName {your_IP}
user {your_user}
IdentityFile ~/.ssh/{your_ssh_key}
Now cat ~/.ssh/{your_ssh_key}.pub}
and copy the output.
Inside your VM, create an ssh folder:
mkdir ~/.ssh
And add your public key to ~/.ssh/authorized_keys
with your terminal editor of choice. Bing bang boom, you should be able to ssh rheldev
without any trouble from your host terminal.
Sources


Member discussion