To transfer a folder without being asked for a password each time with scp, you should set up SSH key-based authentication between your local machine and the remote server.
Here’s how 👇
Step 1: Generate SSH Key (on your local machine) type below command
ssh-keygen -t rsa
Press Enter for default file location (~/.ssh/id_rsa).
If you want, set a passphrase (or leave it empty for no password).
Step 2: Copy the Public Key to Remote Server
or manually:
👉 Enter the password once here.
After this, the key will be stored in ~/.ssh/authorized_keys on the remote server.
Step 3: Test Passwordless Login
If it logs in without asking for a password — you're done.
Step 4: Transfer Folder with scp (No Password Now)
This time it won’t ask for a password.
Comments
Post a Comment