How to Pass Username and Password in cURL Commands Safely?

7 Replies, 1407 Views

Wow, thanks for all the tips, folks! I tried the `.netrc` file method, and it worked like a charm. Set the permissions to 600, and it feels way safer than hardcoding the curl username password in the command.

Quick question though—anyone know if there’s a way to use `.netrc` with multiple hosts? Like, if I need different creds for different servers, can I just stack them in the same file? Or do I need separate files?

Also, big shoutout to the environment variables suggestion—gonna try that next for my scripts. Cheers!

Messages In This Thread



Users browsing this thread: 1 Guest(s)