Name and Password in URL Link for sites and FTP’s

I recently mentioned how awesome the At command is for scheduling tasks. Using wget to retrieve a file from a FTP server – how would one log in? Scheduling the log in would be troubling.

Normally I’d use a real FTP utility and log in, but including the credentials within the URI is good in three cases:
1. Instead of reading the manuals we want to use the easiest way to get the file with wget.
2. We want our grandmothers to download a file, but we know they can’t log in by themselves.
3. Log in quickly.

Please note passwords will be displayed as text. This is obviously not secure.

Log in via URI:

The standard is:

ftp://<user>:<password>@< host>:<port>/< url-path>

Meaning we first specify the protocol, then the user:password and then where we want to go. Example:

http://oscar:asdf@example.com:80/folder1/folder2/file

You only need to enter the port if it’s configured to run on something other than the standard port. I.e. a FTP running on 21 wouldn’t need a port number.

Leave a comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.