Can you specify a password without being prompted using "scp"?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
No. There is no way to give the password in clear text on the command line, otherwise it would be contrary to the nature of the Secure Shell. However you can alway set up Public Key Authentication. See man ssh for details (section AUTHENTICATION) or look for a tutorial on how to set up things using ssh-keygen.
The user creates his/her key pair by running ssh-keygen(1). This stores the private key in
~/.ssh/identity (protocol 1), ~/.ssh/id_dsa (protocol 2 DSA), or ~/.ssh/id_rsa (protocol 2 RSA) and
stores the public key in ~/.ssh/identity.pub (protocol 1), ~/.ssh/id_dsa.pub (protocol 2 DSA), or
~/.ssh/id_rsa.pub (protocol 2 RSA) in the user’s home directory. The user should then copy the pub‐
lic key to ~/.ssh/authorized_keys in his/her home directory on the remote machine.
I think this last bit in the man page is the cause
authorized_keys file corresponds to the conventional ~/.rhosts file, and has one key per line, though
the lines can be very long. After this, the user can log in without giving the password.
But I don't know where to find this "/.rhosts" file, does it mean on my local machine or on the remote machine? I don't see any .rhosts file listed in the "/home" directory or the "/home/.ssh" directory of the user on the remote machine... does it have to be the same username or can I have user "hashbang" on the local machine scping to user "chore" on the remote?
I discovered the "batchmode" option, but now need to figure out the key-pair part.
The option BatchMode=yes simply disables queries for interactive input (password or passphrase) but don't give you passwordless access. If you have followed the steps in the manual page, you should have gained public key authentication.
If it doesn't work you have to verify if proper permissions are set. For example OpenSSH refuse authentication if the private key does not have permissions 600 (read-write for file owner only). Furthermore, you have to tweak the key generation if the remote machine does not run OpenSSH, but another flavour of the Secure Shell.
Finally, if you have changed the name of the keys (different from the default) you should specify the key name on the command line with the -i option
scp -i my_private_key file user@host:
Anyway, look at some tutorials (there are plenty of them in internet) and double check if you have correctly followed all the required steps.