I'm taking a Linux course and I have no idea on how to get past this annoying error:

chcon: cannot access path: No such file or directory

But before that we had to define our virtual host

Perhaps maybe that's where the error resides, but I'm not sure because I've checked and retyped everything but still get the error after replacing everything with my FQDN.

Then he asked us to "create the actual directories we just defined for our Virtual Hosts".

cd /var/www/html
sudo mkdir default
sudo chcon -R -t httpd_sys_content_t beta.lt.unt.edu/ beta-vh.lt.unt.edu/
sudo systemctl restart httpd.service


This is where my brain starts hurting because instead I get this error.

chcon: cannot access ‛elm.lt.unt.edu/elm-vh.lt.unt.edu/’: No such file or directory

Why is it saying that? I asked the instructor but it was no help.

  • trying to change the context of a directory that doesn't exist yet? create it ? – steve Apr 20 at 22:38
  • Hi and welcome! Thanks for contributing! But please, don't post images of text (read this for reasons why). – Kusalananda Apr 21 at 7:59

Two things:

  1. As steve (vaguely) said, you appear to be trying to change the context of directories that don’t exist yet.  You have showed us mkdir default; you need to create elm.lt.unt.edu and elm-vh.lt.unt.edu also.

  2. It looks like you actually said

    sudo chcon -R -t httpd_sys_content_t elm.lt.unt.edu/elm-vh.lt.unt.edu/
    when you should have said
    sudo chcon -R -t httpd_sys_content_t elm.lt.unt.edu/ elm-vh.lt.unt.edu/
    (with a space between the two directory names).

  • Thanks, I had no idea that I actually had to create it. Thank you so much I did mkdir elm.It.unt.edu/ then mkdir elm-vh.It.unt.edu on separate lines and it worked! – JackBrilla Apr 22 at 2:46
  • Well, I guess that’s what your instructor meant when he said, “create the actual directories we just defined for our Virtual Hosts”. – G-Man Apr 22 at 3:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.