Browse Source

if remote user is root, mount / instead of /home/max

master
max.mehl 3 years ago
parent
commit
0079575de8
Signed by: mxmehl GPG Key ID: 2704E4AB371E2E92
  1. 12
      mnt-sftp.sh

12
mnt-sftp.sh

@ -128,9 +128,15 @@ function mount {
fi
# Command to mount actually
if [ "$MAN" = "0" ]; then
sshfs -C "$SSH": "$MOUNTDIR"/ -o follow_symlinks &
else
if [ "$MAN" = "0" ]; then # used for hosts in ssh config
# if user of SSH Host is root, use the root directory as SSHPATH instead of $HOME
if [[ $(ssh -G "$SSH" | awk '/^user / { print $2 }') == "root" ]]; then
SSHPATH="/"
else
SSHPATH=
fi
sshfs -C "$SSH":"$SSHPATH" "$MOUNTDIR"/ -o follow_symlinks &
else # used for manually entered or predefined hosts in app's config
echo "$SSHPASS" | sshfs -C -o password_stdin -p "$SSHPORT" "$SSHUSER"@"$SSHHOST":"$SSHPATH" "$MOUNTDIR"/ -o follow_symlinks &
fi

Loading…
Cancel
Save