Solved

Linux scripts and passwordless authentication

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

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
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…
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

631 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