Tutorial Java and SSH - Printable Version +- Red Security (https://redsecurity.info/cc) +-- Forum: Programming (https://redsecurity.info/cc/forumdisplay.php?fid=5) +--- Forum: Java (https://redsecurity.info/cc/forumdisplay.php?fid=7) +--- Thread: Tutorial Java and SSH (/showthread.php?tid=877) |
Java and SSH - Mr.Kurd - 12-16-2018 In The Name OF Allah Al-Salam Alekum Hello guys, Today I'm going to explain using JSch library in Java to connect with SSH server, executing commands and downloading files. I hope ye all like it... Start your IDE I'm using NetBeans. Add JSch library Download it from here In this example we will connect to our server(VPS) through SSH and run a command (cd /var/www && ls). PHP Code: /* As you see in this image, it shows us html as a commands result. Now all depend on you for Backing up both your website files and SQL database using two commands instead of the one above: Code: zip -r /home/redsecurity.zip /var/www/ && mysqldump --all-databases > /home/all_databases.sql This above will generate a zip files which include our files and the second command will generate a SQL file which include the whole databases data. Note: && separate the two commands. Okay Let's download this files above: PHP Code: /* I'm done if you need anything feel free PMing me or posting here down... Thank you for reading ...... Wa Salam Alekum |