🛠️ “530 Non-anonymous sessions must use encryption” – when using curl

Problem

The error “Non-anonymous sessions must use encryption” occurs when running curl as root:

# 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

However, everything works when running the same curl command as a non-root user:

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

Decision

Add the $ LD_LIBRARY_PATH environment variable to /root/.bash_profile. / usr / bin / curl looks for the / apps / MATLAB / v81 / bin / glnxa64 / directory when looking for the libcurl.so.4 library:

# 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)

Under normal circumstances, / usr / bin / curl is assumed to look for the / usr / lib64 / directory when looking for the libcurl.so.4 library:

# 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. Adding environment variable $ LD_LIBRARY_PATH to /root/.bash_profile will affect all applications running as root, so first remove LD_LIBRARY_PATH in /root/.bash_profile; 2. Then provide the search path at runtime when compiling your Matlab application, please consult your Matlab application vendor and check if there is any way to achieve this. Alternatively, set LD_LIBRARY_PATH when executing the program, for example:

# LD_LIBRARY_PATH= ./app_test

“LD_LIBRARY_PATH = [PATH] b ”will only take effect when the above command is executed, it will not affect other applications.

Sidebar