How to ssh transfer a directory from local to server (ssh passphrase)

With scp you can use the user@server:/location grammar for the ‘from’ and the ‘to’ location. You would run it on your Yunohost, with the username and name/IP of your desktop/laptop/telephone where the files are.

Another option would be to use wget to download the installation files directly from Ninjafirewall to your Yunohost.

Out of curiosity, what does Ninjafirewall do?

If you need to copy / tranfer files with tha root powa… you can use --rsync-path="sudo rsync" in your rsync command.

The rsync-path parameter tells the « remote host » to do sudo rsync to handle the file transfert.

If you have an ssh access to your host on admin@yourhost.tld because you have had copied your ssh key to it for the admin user, you can run rsync like this.

rsync -avh --rsync-path="sudo rsync" /path/to/your/local/file admin@yourhost.tld:/path/to/where/you/want/to/copy/the/file

Another usefull rsync parameter is --chown=.

If the destination file / folder most not be owned by root, and if you have a decently recent version of rsync, you can also use --chown=some_user:some_group.

Because all the Yunohost Apps are mostly runned by their own user (like nextcloud, wordpress, spip, dokuwiki, etc), the files in folders like /var/www/some-app have to be owned by the right user and not root.

Thank you all : I learn a lot on this thread !

@wbk Ninjafirewall is both a WordPress Firewall and security optimizer, I will use it’s non WP php webapp version here. NinTechNet: The Ninja Technologies Network
It’s lightweight, non intrusive, (allows to get rid of the horrible Wordfence, for instance)
I use it for more than 10 years, was never bloated.
It also help nearing A on https://observatory.mozilla.org

1 Like

Me too! I didn’t know about either NinTechNet or Wordfence, and especially the observatory is a nice thing to know about. Thanks!

1 Like

That goes with my tweet. The question I ask myself, and since I’ve never worked with scp before, is how I have to proceed if an entire backup copy has to be moved, whether all files from server A to the new server B with the same backup as in the large screen Package must and can be set again if you have installed Yunohost on server B, i.e. the new server, which you then have to start again with /home/yunohost.backup/archives ? Or how do you put it all back together? Can anyone give me more information on this! Since I have to read myself into the topic again and have had to until now. Since the whole thing is or is the first time for me! Now when I read that on the next screen. Read the whole thing here and thank you if anyone can tell me more about it. I hope I didn’t destroy anyone’s tweet by doing this. But I think questions and answers are welcome here in the forum.

Das passt zu meinem Tweet . Die Frage, die ich mir stelle und da ich noch nie mit scp gearbeitet habe, wie ich hierbei vorgehen muss, wenn einer ganzen Sicherungskopie umziehen muss, ob wie im großen screen dann alle Dateien von Server A nach dem neuen Server B mit demselben, Sicherung Paket so wieder gesetzt werden muss und kann, wenn man Yunohost neu auf dem Server B, also dem neuen Server installiert hat, das man dann mit dem so wieder anfangen muss /home/yunohost.backup/archives ? Oder wie ist das ganzen genauso wieder aufzusetzen? Kann mir jemand dazu mehr an Informationen geben! Da ich mich in das Thema selbst wieder einlesen muss und musste bis jetzt. Da das ganze das erste mal für mich ist, oder sind! Wenn ich jetzt im nächsten Screen das lese. Das ganze hier Lese und danke wenn mir jemand was dazu genaueres Mitteilen kann. Ich hoffe nicht das ich jemandem sein Tweet hiermit zerstört habe. Doch denke ich hier sind fragen und antworten im Forum doch erwünscht. https://linux.die.net/man/1/scp

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.