The Problem
“Non-anonymous sessions must use encryption” occurs when running curl command as root user:
# 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) USER hcpa
However it's working when running the same curl command as 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) AUTH SSL USER hcpa PASS XXX
The Solution
Add $LD_LIBRARY_PATH enviroment variable in /root/.bash_profile.
/usr/bin/curl looks for the directory /apps/MATLAB/v81/bin/glnxa64/ when searching for library libcurl.so.4:
# ldd /usr/bin/curl linux-vdso.so.1 => (0x00007fffc9f7d000) libcurl.so.4 => /apps/MATLAB/v81/bin/glnxa64/libcurl.so.4 (0x00007f291de7b000) /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 circumstance, /usr/bin/curl is supposed to look for the directory /usr/lib64/ when searching for library libcurl.so.4:
# ldd /usr/bin/curl linux-vdso.so.1 => (0x00007fff8dbe1000) libcurl.so.4 => /usr/lib64/libcurl.so.4 (0x00000033ac400000) /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 $LD_LIBRARY_PATH enviroment variable in /root/.bash_profile will impact all applications running as root user, so remove LD_LIBRARY_PATH in /root/.bash_profile first;
2. Then specify the run-time search path when compiling matlab application, please consult with application vendor matlab and check if there is any way to achieve this.
Or
Set LD_LIBRARY_PATH when executing program, for example:
# LD_LIBRARY_PATH=./app_test
"LD_LIBRARY_PATH=[PATH]b" only takes effect when running the above command, it will not impact other applications.