Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Linux scripts and passwordless authentication

Posted on 2013-12-18
3
Medium Priority
?
262 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
acbxyz earned 1336 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 1336 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 30

Assisted Solution

by:serialband
serialband earned 664 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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

670 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