Using wget to download directories over FTP, but n

2019-08-14 09:30发布

When I don't have SSH access to a server, I usually download stuff over FTP, like this:

wget -r ftp://user:pass@server/path/to/dir

How do I keep my password more secure? I don't like that the password is in the command, but when I try something like this:

wget -r ftp://user@server/path/to/dir

it doesn't work. It gives me "Login incorrect".

2条回答
小情绪 Triste *
2楼-- · 2019-08-14 09:45

This also does the trick:

wget -r --ask-password ftp://user@server/path/to/dir

ask_password = on/off can also be declared in your ~/.wgetrc.

查看更多
We Are One
3楼-- · 2019-08-14 09:46

You can put your credentials in ~/.wgetrc like so:

ftp_user = user
ftp_password = pass

Depending on your needs, it is also possible to use a different location for this configuration file:

When initializing, Wget will look for a global startup file, /usr/local/etc/wgetrc by default (or some prefix other than /usr/local, if Wget was not installed there) and read commands from there, if it exists.

Then it will look for the user's file. If the environmental variable WGETRC is set, Wget will try to load that file. Failing that, no further attempts will be made.

If WGETRC is not set, Wget will try to load $HOME/.wgetrc.

查看更多
登录 后发表回答