I have an appVM only for accessing a specific sftp folder from a different Debian computer.
I created a bash script that mounts the folder using an ssh key and run the script to mount the folder each time manually.
Is there a way to auto run the bash script or maybe other way to auto mount the sftp folder each time the appVM starts?
Found a way to add a new line into /etc/fstab, but the change to fstab file is reset each time I restart the appVM
Have you tried /rw/config/rc.local
?
Thanks @renehoj for your response, but I don’t know what exactly should I try to add to /rw/config/rc.local
Should it be the same line that is goes to /etc/fstab in regular linux?
No, you need to enter the same command you would use in the command line, rc.local is just a shell script that is run automatically during the boot sequence.
Ah, OK, let me try
I have added the next line to /rw/config/rc.local of the required qube:
sshfs -v -o IdentityFile=/home/user/.ssh/ssh_key ssh-user@192.168.01.11:/sftp/jails/sftp-folder /usr/local/sftp/sftp_mount
and restarted the qube but the sftp-folder was not mounted, at least the /usr/local/sftp/sftp_mount doesn’t contains anything.
I also executed the above line command manually and the sftp-folder was mounted and it’s not empty, that means the command itself it’s correct, it’s not executed looks like from /rw/config/rc.local
I don’t use sshfs, but I mount both nfs and webdav shares from rc.local.
You can try using the absolute path for sshfs, you can also pipe standard and error out to a file, it might tell you why it’s not working.
Thanks for output suggestion.
I redirected the output and error to a file and added debug:
sshfs -v -odebug,sshfs_debug,loglevel=debug -o IdentityFile=/home/user/.ssh/ssh_key ssh-user@192.168.01.11:/sftp/jails/sftp-folder /usr/local/sftp/sftp_mount 2>&1 | tee /home/user/Downloads/output.txt
the output I received:
debug1: read_passphrase: can't open /dev/tty: No such device or address Host key verification failed. read: Connection reset by peer
Google seems to think that Host key verification failed.
is because of a mismatch with the user running the command and the expected ~/.ssh/known_hosts