if remote user is root, mount / instead of /home/max
This commit is contained in:
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user