Answers:
Wget解释<pass>@serveraddress为端口。要指定用户名和密码,请使用--user和--password开关:
wget --user user --password pass http://example.com/
来自man wget:
--user=user
--password=password指定的用户名用户和密码,密码的FTP和HTTP文件检索。这些参数可以使用被覆盖
--ftp-user和--ftp-password选项FTP连接和--http-user和--http-passwordHTTP连接选项。
--ask-passwordNabil Kadimi的回答所描述的选项。它让您在另一行上不可见地输入密码,并且避免将其存储在Shell历史记录中。
您有3个选择,此处除了胆量感觉外没有其他特定顺序:
history)wget --user=remote_user --password=SECRET ftp://ftp.example.com/file.ext
密码也将以ps,top,htop和类似形式显示。
wget --user=remote_user --password=SECRET ftp://ftp.example.com/file.ext
请注意命令前的空白,它防止将其保存到您的历史记录中。
密码也将以ps,top,htop和类似形式显示。
wget --user=remote_user --ask-password ftp://ftp.example.com/file.ext
Password for user `remote_user': [SECRET (not visible)]
--ask-password不可用或您不想每次都输入密码,wget -i link.txt可以提供帮助,其中link.txt包含ftp://remote_user:SECRET@ftp.example.com/file.ext
该命令可以使用--http-user和--http-password代替--userand --password。如果需要,ftp选项为--ftp-user和--ftp-password。
man wget表示--user和--password是有效选项,可以由--http-user或--ftp-password 覆盖
wget分别为它们提供了单独的命令行选项,因此可能天真地将字符串后的字符串解析:为端口号。