0
I changed my operating system from Windows to Fedora a few days ago. So I am a really beginner in any Linux stuff.
My basic goal is to add a remote drive (my cloud drive) on start up so I can use it. I tried to create a bash script which will be executed on startup by using sftp
. I found the following code
sshfs user@sftp.example.com:/targetpath ~/mountdir
My problem is that this works with root permissions but it does not work with my user permissions. Executing with my normal privileges I get the error read: Connection reset by peer
. Because I want to execute this on start up I don't want to use root permissions.
Also I searched for a solution to save my user name and the password but I didn't find something yet so I don't have to type them in every time.
Background
Fstab: I googled a lot which lead me to the fstab
file at first. I spent a full day and ended up with breaking the system because the internet connection was not present when starting the system so the target disk could not be included (at least I think that's what was happening).
Script (WebDAV, sftp): I then tried to use WebDAV with
mount -t davfs2 https://webdav.example.com ~/mountdir
but this also only works with root permissions (Error: mount: only "root" can do that
). My next step was then to use sftp which kind of seems to work better. But then I got the error mentioned above (Error: read: Connection reset by peer
).
I don't want to store the files locally because there is not enough disk space available.
I'm sorry if this is a stupid or very basic question but I don't find any way to go on. Thank you for your help.
Thank you for your answer. I will defently check out certificates. But still it does not work. If I execute your script I still get the same error
read: Connection reset by peer
. If I addsudo
in front of your commands it works. Also I had some struggles with my password because it contains an "!". May that be the thing so normal users are not allowed to use "!"? – miile7 – 2019-12-12T08:47:50.960