Computing, Linux, system administration, Ubuntu, virtual machines

Installing VirtualBox Guest Additions in Ubuntu guests

When you’ve installed an operating system in a virtual machine, you usually want to install special drivers and tools inside it to enhance performance and features. With VirtualBox, this is done through the Guest Additions.

Many guides out there instruct you to install VirtualBox Guest Additions from the CD image (ISO). But in recent versions of Ubuntu, you can install them through the package manager, which is much simpler, and you can keep the Guest Additions automatically updated.

In Ubuntu 20.04 (Focal Fossa), the Guest Additions are installed by typing:

sudo apt install virtualbox-guest-dkms virtualbox-guest-x11

If it doesn’t work, make sure you have the multiverse repository enabled:

sudo add-apt-repository multiverse

That’s all. Thanks to LinuxConfig.org for instructions.

Computing, file sharing, Linux, security, Ubuntu

Using SSHFS for simple file sharing

The SSHFS file system can be used for simple file sharing between computers. It only requires that the server has SSH installed, and that you can install SSHFS on your local computer.

Pros:

  • Secure SSH encryption
  • Very easy to set up

Cons:

  • Only intended for one user at a time

On the server side, you only need a standard SSH server. It provides encryption and file services to clients. No special configuration is needed

On the client side, you need the SSHFS file system to mount the network share. On ubuntu, this can be installed with:

sudo apt install sshfs

Then you can mount a remote user’s folder with

sshfs -o idmap=user $USER@$REMOTEHOST:$REMOTEFOLDER $LOCALFOLDER

Replace $USER with the user name on the remote computer. You will get access to that user’s home directory.

Replace $REMOTEHOST with the address of the computer you want to connect to.

Replace $REMOTEFOLDER with the folder you want access to. This is relative to the user’s home directory.

Replace $LOCALFOLDER with the local folder you want to mount the share on.

-o idmap=user” translates the remote user id of the files to your own user id, and vice versa. Files that are owned by $USER on the server, will appear owned by you in the local mounted directory.

Computing, file sharing, Linux, security, Ubuntu

Glaring SMB file sharing issues

There’s a glaring bug in gvfs that prevents you from browsing shares using the SMB v2 protocol, which is default in many Linux distributions.
This means if you install a brand new copy of Ubuntu 20.04, set up a share using Samba, and try to connect with it using your file manager, you can’t even connect to a share on your own computer!
To make it work, you have to explicitly change the Samba configuration (/etc/samba/smb.conf) to allow the SMB v1 protocol:

server min protocol = NT1

However, there’s a reason SMB v1 is turned off; it has huge security issues.

So I decided to use SSHFS for simple file sharing instead.