-
-
Save fengs/11129645 to your computer and use it in GitHub Desktop.
Secure copy to/from remote host using scp and ssh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make sure ssh-client is installed | |
# login | |
$ ssh user@remotehost | |
# generating key pairs | |
$ ssh-keygen -t dsa | |
# install the key by either of the commands | |
$ scp ~/.ssh/id_dsa.pub user@remotehost:.ssh/authorized_keys | |
$ ssh-copy-id user@remotehost | |
# from now on, no password prompt will appear after login | |
# ssh user@remotehost | |
# secure copy a file to the remote host | |
$ scp /source_path/filename user@remotehost:destination_path/newfilename | |
# recursively copy a folder, preserving timestamp with -rp flags | |
$ scp -r /source_path/folder user@remotehost:destination_path/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment