Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to pass parameters in text file and read it in curl command. Like:I added username and password in text file

Sample.txt:
username:"admin"
password:"admin"

In curl command, I'm reading like this:

curl -K Sample.txt -u $username:$password http://localhost:4502/content/dam/my folder

But, this command isn't working.

Could please figure out the problem?

share|improve this question
up vote 2 down vote accepted

-K doesn't work like that, it works like this:

put

-u username:password

in the sample.txt file and do

curl -K Sample.txt "http://localhost:4502/content/dam/my folder"

share|improve this answer
    
It's working fine. Thanks! But, when I run it using cron job then it doesn't work. – HIMANSHU SINGHAL Jun 26 at 4:02
    
crontab has tricky quoting rules, perhaps it's the space in the filename. – Jasen Jun 26 at 4:09
    
yeah, I tried. It's working :) – HIMANSHU SINGHAL Jun 26 at 6:34
    
But, whatever we providing, it's in plane text. Is their anyway, we can encrypt text file and read it in curl so nobody can read it? – HIMANSHU SINGHAL Jun 26 at 6:36
    
AFAICT no. best make it so that the password can't do serious damage if it leaks – Jasen Jun 26 at 6:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.