Score:0

Running Ubuntu as an app under Windows 11, how can I locate a specific file in the Ubuntu file structure (which I can see from the Windows side)?

ug flag

The file I need to edit, php.ini, sits in this directory (per Windows): Linux > Ubuntu > etc > php > 8.1 > apache2 > , or, apparently, \wsl.localhost\Ubuntu\etc\php\8.1\apache2
How can I parlay that information in order to change permissions on the php.ini file? Can this even be done from within the Ubuntu app? Much obliged for any help.

Score:0
ng flag

You can use chmod to change permissions of files.

A typical chmod command will have the following syntax:

chmod ### /path/to/file

Replace ### with the desired permissions, and replace /path/to/file with the path of the file whose permissions you want to change.

You can use a tool like chmod calculator to help you figure out the notations for permissions.

It's also important that you enter a valid path with accurate syntax.


That being said, it might be a good idea to make sure that your question is not an XY Problem. Apache files should already be set up with the correct permissions. You generally do not need to change permissions on system and application files, and doing so could potentially break your software.

Pardieu Popper avatar
ug flag
Unfortunately I could not see the file location and hence a path inside the Ubuntu app on Windows. The solution came when I opened Notepad as an administrator, then opened the php.ini file I wanted to modify, made my changes and saved that file without incident or protest. After restarted apache2 and restarting my original program, it worked. Although this answer did not work for me, it did spur me on to try something else that did work. Much appreciated.
Pardieu Popper avatar
ug flag
Thanks, Nmath - on strike. Using sudo requires knowing the path to the file, but in the Windows 11 wsl Ubuntu app, I was not able to locate the path. Only in Windows could I see the path. The solution as suggested by Ubuntu help was to locate the file, php.ini in this case, by invoking Explorer.exe from the command line. That does indeed work, but once there I could not modify the file because of the permissions issue. I readily confess a Linux expert, which I am not, might see a different solution.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.