if remote user is root, mount / instead of /home/max
This commit is contained in:
10
mnt-sftp.sh
10
mnt-sftp.sh
@@ -128,9 +128,15 @@ function mount {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Command to mount actually
|
# Command to mount actually
|
||||||
if [ "$MAN" = "0" ]; then
|
if [ "$MAN" = "0" ]; then # used for hosts in ssh config
|
||||||
sshfs -C "$SSH": "$MOUNTDIR"/ -o follow_symlinks &
|
# 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
|
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 &
|
echo "$SSHPASS" | sshfs -C -o password_stdin -p "$SSHPORT" "$SSHUSER"@"$SSHHOST":"$SSHPATH" "$MOUNTDIR"/ -o follow_symlinks &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user