Solved

Linux scripts and passwordless authentication

Posted on 2013-12-18
3
257 Views
Last Modified: 2013-12-19
I can get this scp command to work

scp test.file root@xxclnt2:/home
root@xxclnt2's password:

But as you can see it requires a password

How can I turn off the password authentication required of scp commands ?

Thanks
0
Comment
Question by:Los Angeles1
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
acbxyz earned 334 total points
ID: 39727968
You can use a private key for authentication instead of a password:
a) create a private/public keypair with ssh-keygen
b) copy the line in your public key to the file root@xxclnt2:/root/.ssh/authorized_keys
c) set the right permissions:
root@xxclnt2# chown root.root ~/.ssh ~/.ssh/authorized_keys
root@xxclnt2# chmod 700 .ssh
root@xxclnt2# chmod 600 .ssh/authorized_keys

Open in new window

d) use scp -i yourprivatekey.id_rsa
0
 
LVL 10

Assisted Solution

by:acbxyz
acbxyz earned 334 total points
ID: 39727988
As a (very bad) option b) you can search for sshpass.
http://www.linuxquestions.org/questions/linux-newbie-8/how-to-add-password-paramtre-to-ssh-command-807560/
But to repeat , you should not use a password (especially root) as command line argument.
0
 
LVL 28

Assisted Solution

by:serialband
serialband earned 166 total points
ID: 39728021
Once you've created your passphrase and loaded your public key into the remote systems ~/.ssh/authorized_keys file, acbxyz instructed, run the following.

eval ssh-agent
ssh-add YOUR_PRIVATE_KEY

It will prompt you for your passphrase once per open terminal session.  Afterwards, all your ssh calls to remote systems that you've added your public key to will use the cached ssh key credentials.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Video Streaming 6 73
Securing Azure Oracle instance of Linux VM 4 58
awk variable in printf 1 25
SUSE Linux Enterprise 11.x Ensure tftp server is not enabled 1 25
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question