One of the easiest ways would be to add your key to the remote host. To add your key to the remote host so that ssh / scp does not require a password you can run:
ssh-copy-id username@host.edu
Then you can use scp to copy from the remote to the client system in the current folder you are in:
scp username@host.edu:/path/to/file/filename .
Or copy it to any folder that you have write access to on your client host:
scp username@host.edu:/path/to/file/filename /local/folder/to/store/in/
Another way to do it would be to install sshpass (sudo apt install sshpass
) on your client system. Then you can use it to log into the remote host and run the commands that way. One thing to remember that storing a password in a script can be read by anyone that has access to the script.
To use sshpass
see https://askubuntu.com/a/385850/231142