No such file or directory

The operating system my web server runs on is (include version): gnu/linux ubuntu


When my server tries to open this address, I get:
fopen: No such file or directory. I run my program as su (root)

What should I do ?

How does your server try to open said file? What program are we talking about?

Through openssl lib: SSL_CTX_use_certificate_file & SSL_CTX_use_PrivateKey_file

It works with other cert and key files e.g from ZeroSSL. But their files are in folders that dont require password

@qrazyneo You’re still making it very hard to determine what might be the cause of this. You’re not answering all of my questions and some more background information might be useful to keep us from guessing. Also, the folders of certbot (assuming you’re using certbot from the directory layout…) aren’t password protected, so I have no idea why you’re making that assumption. Also… Password protected directories in Linux in general: I’m not familiair with it.

Hi @qrazyneo,

As @Osiris said, that’s pretty confusing for us without more context. Usually the internal paths on Unix servers are filesystem paths that start with /, not URLs that start with a protocol schema like admin:. So we don’t really understand exactly what software you’re using that’s trying to reference a file this way, because it’s not a particularly familiar notation for referring to a file on your system.

Your problem statement is not very clear. Perhaps “admin://” part is your custom prompt and “/etc/letsencrypt/live/mydomain/privkey.pem” is a path to an actual key file. You are saying that you are running the “program” as a root - presumably that is the program creating the key. And then your web server cannot open it. There is also some mentioning of a password, which is also not clear at all (in theory this could be related to encrypted filesystems, but I doubt it’s the case here).

Most typical problem which could fit your description might be the permissions, often stemming from the “umask” of the user creating the file. Simply put, when some file is created, it is assigned “permissions” to access that file - access by the user itself, by the group that user belongs to and by everyone else. The file is also “owned” by a specific user and the group.

Your web server runs as a certain user (often something like “www” for Apache or “nginx” for Nginx). To be able to read the file you have created as a “root”, you would need to either have that file readable by everyone else (not a great idea usually) or have that file owned by the group the web server user belongs to and readable by that group.

If you post the output of

ls -al /etc/letsencrypt/live/mydomain/privkey.pem

and specify which web-server exactly you are using, perhaps it will make it clearer regarding what sort of an issue you are having.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.