add mount-sftp script
This commit is contained in:
parent
bdf04302aa
commit
4dfe68a54b
20
scripts/mount-sftp.sh
Executable file
20
scripts/mount-sftp.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
LOCAL_USER=$(id -un)
|
||||
MOUNT_PATH="/home/$LOCAL_USER/sftp"
|
||||
|
||||
if [ ! -d "$MOUNT_PATH" ]; then
|
||||
mkdir -p "$MOUNT_PATH"
|
||||
fi
|
||||
|
||||
CREDS=$(cat "/home/$LOCAL_USER/.sftp.json")
|
||||
USER=$(echo $CREDS | jq -r '.user')
|
||||
PASS=$(echo $CREDS | jq -r '.pass')
|
||||
HOST=$(echo $CREDS | jq -r '.host')
|
||||
|
||||
echo "Mounting SFTP server..."
|
||||
|
||||
echo $PASS | sshfs "$USER@$HOST:/" "$MOUNT_PATH" \
|
||||
-o password_stdin \
|
||||
-o reconnect \
|
||||
-o compression=yes
|
Loading…
Reference in New Issue
Block a user