I am new to Ubuntu but I have to do a small script which backups all my files on my server to my local computer. I made a script on my server called backupscript and put the following command
zip -r Backupfile /home/ubuntu
sudo scp -P 22 /home/ubuntu/Backupfile.zip user@ipaddress:/home/user
I save it and execute this script from terminal ./backupscript
But then I get a message ssh: connection to host ipaddress port 22: connection lost.
I opened port 22 in my host computer using this
sudo ufw allow 22
but still unable to scp the file from my server to host computer.