Solved

Linux scripts and passwordless authentication

Posted on 2013-12-18
3
256 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
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…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now