如何使用linux命令行ftp与@签署在我的用户名?[关闭]

ua4mk5z4  于 2023-04-20  发布在  Linux
关注(0)|答案(7)|浏览(137)

**已关闭。**此问题不符合Stack Overflow guidelines。当前不接受答案。

此问题似乎与a specific programming problem, a software algorithm, or software tools primarily used by programmers无关。如果您认为此问题与another Stack Exchange site主题相关,您可以留下评论以解释在何处可以回答此问题。
8年前关闭。
Improve this question
当我的用户名中间有一个@符号时,我如何在linux命令行上运行这个?

ftp -u user:password@host/destination_folder/ sourcefile.txt

我的用户名是info@domain.com,它认为我的主机是domain.com
注意:这是一个无人值守的上传,所以我不能只输入用户名和密码。

q3qa4bjr

q3qa4bjr1#

试试这个:使用“%40”代替“@”

zphenhs4

zphenhs42#

作为替代方案,如果您不想创建配置文件(或者您不想依赖于系统特定的 ftp 命令的行为),请使用curl而不是ftp进行无人值守上传:

curl -u user:password -T file ftp://server/dir/file

如果出于安全原因不希望ps(进程列表)显示传递给 curl 的密码,请参阅answers to this question

neekobn8

neekobn83#

尝试在~/.netrc文件中定义帐户,如下所示:

machine host login info@domain.com password mypassword

查看man netrc了解详细信息。

lawou6xi

lawou6xi4#

我只需输入ftp hostdomain.com,下一个提示符要求我输入一个名称,如果它与我当前的用户不相同。
我猜这取决于你的FTP是如何配置的.也就是说,它是否假设相同的用户名(如果没有提供)或要求.好消息是,即使没有解决方案,下次你面对这个问题可能只是工作™为你:D

ct2axkht

ct2axkht5#

一个更完整的答案是ftp不可能(至少是安装在centos6上的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.
f4t66c6m

f4t66c6m6#

curl -f -s --disable-epsv -usomeone@somewhere.com:gr8p455w0rd -T /some/dir/filename ftp://somewher.com/ByramHealthcareCenters/byram06-2011.csv

camsedfj

camsedfj7#

我从来没有见过-u参数。但是如果你想使用一个“@",把它声明为“@"怎么样?
那样的话,它应该被解释为你的意图。你知道一些像

ftp -u user\@domain.tld@ftp.host.tld

相关问题