Basically follow https://leighmcculloch.com/posts/ubuntu-encrypt-home-directory-with-gocryptfs/. But there are some extensions I added so that mounting also works with ssh.
user_allow_other in /etc/fuse.conf <volume
user="some_username"
fstype="fuse"
options="nodev,nosuid,quiet,nonempty,allow_other"
path="/usr/bin/gocryptfs#/home/some_username.cipher"
mountpoint="/home/some_username"
/>
auth optional pam_mount.so
cd /home
sudo tar cvf $USER.tar $USER
sudo mkdir $USER.cipher
sudo chown $USER:$USER $USER.cipher
gocryptfs -init $USER.cipher
rm -fr /home/$USER/* /home/$USER/.* # Keep .ssh .bashrc and .profile
touch /home/$USER/GOCRYPTFS_NOT_MOUNTED
gocryptfs -nonempty $USER.cipher $USER
tar xvf $USER.tar --strip-components=1 -C $USER
touch /home/$USER/GOCRYPTFS_MOUNTED
sudo login -f $USER
This is necessary for ssh login with publickey because then a password is missing. And without the line there would also be no prompt for the gocryptfs password. So there was no automatic login and you had to gocryptfs -nonempty /home/$USER.cipher /home/$USER to mount.
rm /home/$USER.tar