Solved

Linux scripts and passwordless authentication

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

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Currently, there is not an RPM package available under the RHEL/Fedora/CentOS distributions that gives you a quick and easy way to allow PHP to interface with Oracle. As a result, I have included a set of instructions on how to do this with minimal …
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
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 find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

758 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

19 Experts available now in Live!

Get 1:1 Help Now