If I am working in a terminal that is currently SSH
logged in to a remote server user@node
, and I want to transfer a file from local to that same server, I will run:
scp you@your_local_machine:/home/you/"FileName.csv" user@node:"~/folder"
It'll then ask for my local machine's login password. This is fine, but is there a way that I can modify the above scp
call to automatically enter my password to the terminal instead of needing to type it in manually?
SSH (Secure Shell) can be set up with public/private key pairs so that you don't have to type the password each time. On the local machine,type
ssh-keygen -t dsa
To get the key on the server, you have two choices:
ssh-copy-id
(standard with most Linuxes), e.g. ssh-copy-id user@server
~/.ssh/id_dsa.pub
file into the file ~/.ssh/authorized_keys
on the remote host.Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments