使用wget来通过FTP下载目录,但没有通过密码作为参数 [英] Using wget to download directories over FTP, but not passing the password as a parameter

查看:180
本文介绍了使用wget来通过FTP下载目录,但没有通过密码作为参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我没有到服务器的SSH访问,我平时下载的东西通过FTP,像这样的:

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".

推荐答案

您可以把您的凭据中的 〜/ .wgetrc 像这样:

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

ftp_user = user
ftp_password = pass

根据您的需求,它也可以使用此配置文件不同的地点

当初始化时,Wget的会寻找一个全球性的启动文件,在/ usr / local / etc中/默认wgetrc(或在/ usr /本地其他一些preFIX,如果Wget的没有被安装在那里)和读取命令在那里,如果它的存在。

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.

然后,它会查找用户的文件。如果环境变量WGETRC设置,Wget的会尝试加载该文件。如果做不到这一点,没有进一步的尝试将会作出修改。

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.

如果没有设置WGETRC,Wget的会尝试加载$ HOME / .wgetrc。

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

这篇关于使用wget来通过FTP下载目录,但没有通过密码作为参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆