如何在我的用户名中使用带有@符号的linux命令行ftp? [关闭]
题
当我的用户名在中间有 @
符号时,如何在linux命令行上运行?
ftp -u user:password@host/destination_folder/ sourcefile.txt
我的用户名是 info@domain.com
,它认为我的主机是 domain.com
。
注意:这是无人值守的上传,因此我不能只输入用户名和密码。
解决方案
作为替代方案,如果您不想创建配置文件,请使用 curl
而不是 ftp
进行无人值守上传:
curl -u user:password -T file ftp://server/dir/file
其他提示
试试这个:使用“%40”代替“@”
尝试在〜/ .netrc
文件中定义帐户,如下所示:
machine host login info@domain.com password mypassword
查看 man netrc
了解详情。
我只需输入 ftp hostdomain.com
,然后下一个提示要求我输入一个名称,如果它与我当前的用户不一样。
我想这取决于你的FTP配置方式。也就是说,它是否采用相同的用户名(如果没有提供)或要求。好消息是,即使没有解决方案,下次你面对这个问题时,它可能只是工作™为你:D
更完整的答案是使用ftp是不可能的(至少在centos 6上安装了ftp程序)。
由于你想要一个没有参加的过程,“pts”的回答会正常。
使用curl而不是ftp进行无人值守上传:
curl -u user:password -T file ftp://server/dir/file
%40似乎不起作用。
[~]# ftp domain.com
ftp: connect: Connection refused
ftp> quit
[~]# ftp some_user%40domain.com@domain.com
ftp: some_user%40domain.com@domain.com: Name or service not known
ftp> quit
我所有的就是打开ftp程序并使用域名并在被问到时输入用户。通常,无论如何都需要密码,因此交互性质可能没有问题。
[~]# ftp domain.com
Connected to domain.com (173.254.13.235).
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 2 of 1000 allowed.
220-Local time is now 02:47. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Name (domain.com:user): some_user@domain.com
331 User some_user@domain.com OK. Password required
Password:
230 OK. Current restricted directory is /
Remote system type is UNIX.
Using binary mode to transfer files.
curl -f -s --disable-epsv -u someone@somewhere.com:gr8p455w0rd -T / some / dir / filename ftp://somewher.com/ByramHealthcareCenters/byram06-2011.csv
我从未见过 -u
参数。但如果您想使用“@”,请将其说明为“\ @”?
这样就应该按照你的意愿来解释。你知道像
这样的东西ftp -u user\@domain.tld@ftp.host.tld
不隶属于 StackOverflow