0

Like the title of the question says i am wondering why i get following error when executing following command inside my bash script:

Command: sudo cp openssl/localhost.pfx /mnt/c/Users/bob/.aspnet/https

Output: cp: cannot create regular file '/mnt/c/Users/bob/.aspnet/https': No such file or directory

The directory on Windows does exists!

7
  • why do you use ** for Users? Commented Jan 20, 2023 at 15:53
  • Its just to hide the path :) Commented Jan 20, 2023 at 15:53
  • 1
    There you go, i changed it Commented Jan 20, 2023 at 15:59
  • 1
    is "https" a folder, or you want the target file to have the name "https" ? Commented Jan 20, 2023 at 16:02
  • 1
    Are you sure this path exists? can you cd to it? Commented Jan 20, 2023 at 16:04

1 Answer 1

1

If your path is correct, you can try running this command after sudo su:

sudo su
cp openssl/localhost.pfx /mnt/c/Users/bob/.aspnet/https
5
  • If the command didn't work directly with sudo, it won't work either after a sudo su. Something else is going on.
    – joanis
    Commented Jan 22, 2023 at 15:29
  • 1
    @joanis that isn't true sudoers group has different permissions than root typicall. superuser.com/questions/299322/… Commented Jan 22, 2023 at 19:40
  • The weird thing about it is that following command works: sudo cp openssl/localhost.crt /usr/local/share/ca-certificates but the one that i mention in the question don't. Both paths exists (can cd to both paths in a manual way) Commented Jan 23, 2023 at 8:08
  • Maybe it has something to do with mounting? Commented Jan 23, 2023 at 8:48
  • @MaximilianBallard you're t right, I wasn't thinking straight. Thanks for the correction.
    – joanis
    Commented Jan 23, 2023 at 13:36

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