Mount residence sparsebundle when SSH

I'm making use of FileVault to secure my homedir. Yet when I'm not logged (in your area) right into my remote equipment and also I'm attaching to it trough SSH my residence has just the sparsebundle documents.

Just how can I place it so my residence dir shows up generally as a neighborhood login on the equipment?

2019-05-05 17:14:01
Source Share
Answers: 1


SSH allows you create a ~/.ssh/rc that will certainly be implemented right after the setting has actually been set up, yet prior to any kind of shell will certainly be energetic (so beware of that ; look for "sshrc" in man ssh(8) for additional information).

So, to place your FileVault dividing you can add this line to your ~/.ssh/rc documents :

hdiutil attach /Users/$USER/$USER.sparsebundle -mountpoint /Users/$USER

Do not stress, your ~/.ssh/rc will certainly be readily available to the system also prior to placing the FileVault dividing.


Now you need to make certain the unmount at logout, and also just if you are attached using ssh. To do that you can utilize your shell's logout manuscript. These are the logout manuscript courses for the 3 most made use of coverings on Macs (do not hesitate to add extra in the remarks) :

  • slam : ~/.bash_logout
  • zsh : ~/.zlogout
  • (t) csh : ~/.logout

Open (or create) the ideal documents and also add :

if [[ -n $SSH_CONNECTION ]]
    then hdiutil detach /Users/$USER/$USER.sparsebundle
2019-05-08 07:12:09