“️“ 530非匿名会话必须使用加密”-使用curl时

问题

当以root身份运行curl时,发生错误“非匿名会话必须使用加密”:

# curl -v -k --ftp-ssl --ftp-pasv ftp://192.168.X.X:990/ --user hcpa:XXX
* About to connect() to 192.168.X.X port 990 (#0)
* Trying 192.168.X.X... connected
* Connected to 192.168.X.X (192.168.X.X) port 990 (#0)
< 220 FTP SERVER INFOVALMER.
> USER hcpa
< 530 Non-anonymous sessions must use encryption.
* Access denied: 530
* Closing connection #0
curl: (67) Access denied: 530

但是,当以非root用户身份运行相同的curl命令时,一切正常:

# exit
logout
# su - testuser
$ curl -v -k --ftp-ssl --ftp-pasv ftp://192.168.X.X:990/ --user hcpa:XXX
* About to connect() to 192.168.10.1 port 990 (#0)
* Trying 192.168.X.X... connected
* Connected to 192.168.X.X (192.168.X.X) port 990 (#0)
< 220 FTP SERVER INFOVALMER.
> AUTH SSL
< 234 Proceed with negotiation.
* Initializing NSS with certpath: /etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* skipping SSL peer certificate verification
* NSS: client certificate not found (nickname not specified)
* SSL connection using SSL_RSA_WITH_3DES_EDE_CBC_SHA
* Server certificate:
* subject: ,CN=ftp-infovalmer,OU=VALORADOR,O=INFOVALMER,L=BOGOTA,ST=CUNDINAMARCA,C=CO
* start date: sep 10 22:11:55 2015 GMT
* expire date: sep 09 22:11:55 2018 GMT
* common name: ftp-infovalmer
* issuer: @ ,CN=ftp-infovalmer,OU=VALORADOR,O=INFOVALMER,L=BOGOTA,ST=CUNDINAMARCA,C=CO
> USER hcpa
< 331 Please specify the password.
> PASS XXX
< 230 Login successful.

决定

将$ LD_LIBRARY_PATH环境变量添加到/root/.bash_profile。 / usr / bin / curl在查找libcurl.so.4库时会查找/ apps / MATLAB / v81 / bin / glnxa64 /目录:

# ldd /usr/bin/curl
linux-vdso.so.1 => (0x00007fffc9f7d000)
libcurl.so.4 => /apps/MATLAB/v81/bin/glnxa64/libcurl.so.4 (0x00007f291de7b000) <-----
libidn.so.11 => /lib64/libidn.so.11 (0x0000003201600000)
libldap-2.4.so.2 => /lib64/libldap-2.4.so.2 (0x00000033afc00000)
librt.so.1 => /lib64/librt.so.1 (0x00000033ab400000)
libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00000032bba00000)
libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00000032bc200000)

通常情况下,当寻找libcurl.so.4库时,假定/ usr / bin / curl会寻找/ usr / lib64 /目录:

# ldd /usr/bin/curl
linux-vdso.so.1 => (0x00007fff8dbe1000)
libcurl.so.4 => /usr/lib64/libcurl.so.4 (0x00000033ac400000) <-----
libidn.so.11 => /lib64/libidn.so.11 (0x0000003201600000)
libldap-2.4.so.2 => /lib64/libldap-2.4.so.2 (0x00000033afc00000)
librt.so.1 => /lib64/librt.so.1 (0x00000033ab400000)
libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00000032bba00000)
libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00000032bc200000)

1.在/root/.bash_profile中添加环境变量$ LD_LIBRARY_PATH将影响以root用户身份运行的所有应用程序,因此,请首先删除/root/.bash_profile中的LD_LIBRARY_PATH; 2.然后在编译Matlab应用程序时在运行时提供搜索路径,请咨询您的Matlab应用程序供应商,并检查是否有任何方法可以实现此目的。 或者,在执行程序时设置LD_LIBRARY_PATH,例如:

# LD_LIBRARY_PATH= ./app_test

“ LD_LIBRARY_PATH = [PATH] b”只会在执行上述命令时生效,不会影响其他应用程序。

Sidebar