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!
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
according to the manpage for scp, the -p option is to preserve timestamps on the files (and not the password). if you run it without the -p option it should prompt you for password.
I agree with schneidz. But if you are stuck and need to use a password with SCP you can always use 'sshpass' or 'expect'. A quick internet search will turn up plenty of examples for both of them.
But if you are stuck and need to use a password with SCP you can always use 'sshpass' or 'expect'.
Both of these methods have serious security problems.
You should instead use public/private key authentication either with ssh-agent or with a private key that is not protected by a passphrase but has limited functionality using the command="XXX" option in the authorized_keys file.
You should instead use public/private key authentication
Thats what schneidz said here:
Quote:
if you are trying to automate something you should set up public key encryption:
and as far as this goes:
Quote:
Both of these methods have serious security problems.
True - only if you are talking about making a permanent script.
Using expect and sshpass for a short term, one run script is not necisarrily a security problem. As I mentioned, 'if you are stuck' and absolutely have to get this done with a password, then they are good fire and forget solutions, but shouldn't be used for permanent scripts.
Also, the bigger security problem is that they are using passwords at all. But that is a whole different question.
Last edited by szboardstretcher; 11-17-2014 at 09:22 PM.
True - only if you are talking about making a permanent script.
Sorry, but I disagree. Even if it is not permanent it still means that the root password will be stored in plain text on that machine.
Quote:
Originally Posted by szboardstretcher
Using expect and sshpass for a short term, one run script is not necisarrily a security problem.
Not only is it a security problem, it is also wasted effort. Why bother setting this up if it is only to be used once. Just enter the password at the prompt.
Quote:
Originally Posted by szboardstretcher
As I mentioned, 'if you are stuck' and absolutely have to get this done with a password, then they are good fire and forget solutions, but shouldn't be used for permanent scripts.
The OP clearly has root access on that machine, so presumably OP can configure it to accept public key authentication (which is anyway the default on any sshd install I've seen).
Quote:
Originally Posted by szboardstretcher
Also, the bigger security problem is that they are using passwords at all. But that is a whole different question.
Actually, I'd probably argue that allowing root to ssh in is a bigger problem.
It would be stored on the computer temporarily. That means that it is deleted afterward.
I create scripts all the time that are only used for an hour or so. And sometimes I hardcode a password into them, so I don't have to re-type the password 100 times while I am testing the script. Once I'm done, the script is wiped.
I applaud you if you have never, ever made a script that you had to hard code a password in for temporary usage. But for some of us, this happens occasionally.
And perhaps you work in an environment where you can just willy-nilly change the authentication method from password to ssh-keys. Thats applaudable too. But not everyone has that kind of freedom, and we are stuck with workarounds until it can be changed.
Last edited by szboardstretcher; 11-18-2014 at 08:57 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.