Skip to content

Instantly share code, notes, and snippets.

@sukima
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sukima/9458901 to your computer and use it in GitHub Desktop.
Save sukima/9458901 to your computer and use it in GitHub Desktop.
Allow user ssh authorized_keys access with ecryptfs hosts
realdir="/home/.ecryptfs/$USER/.ssh"
edir="$HOME/.ssh"
link_files=(authorized_keys authorized_keys2 authorized_hosts known_hosts)
mkdir -m 700 $realdir
for file in ${link_files[@]}; do
if [ -e $edir/$file ]; then
cp $edir/$file $realdir/$file
chmod 600 $realdir/$file
rm $edir/$file
fi
ln -s $realdir/$file $edir/$file
done
ecryptf-unmount-private
chmod 700 $HOME
mkdir -m 700 $edir
chmod 500 $HOME
for file in ${link_files[@]}; do
ln -s $realdir/$file $edir/$file
done
ecryptf-mount-private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment