Select-String : The file C:\Users\XXXXXXX\AppData\Local\Temp\debug cannot be read: Access ... denied

Advertisement

SmurfnSurf
Joined:
Posts:
5

Select-String : The file C:\Users\XXXXXXX\AppData\Local\Temp\debug cannot be read: Access ... denied

Background: I use to have WinSCP Portable in C:\Utils\WinSCP, for many years.

I wanted to use the Search TEXT within files feature, via the built-in extension, so I installed WinSCP Windows Installer in Win11 "for everyone" and selected the custom install, to the C:\Utils\WinSCP dir, not the default dir.

I then ran the Commands > Static Custom Commands > Search for Text Extension.

PowerShell window comes up, searches, finds my text (simply QTPi4Eth in *.* from root on an Asus Router), continues 3 more lines then I get this error below (User Redacted to XXXXXX).

I have searched the forum but cannot find a similar instance that has been answered and solved. How can I help you troubleshoot this please?

File /data/boot_state_0 matches mask, searching contents...
File /data/scratchpad matches mask, searching contents...
File /debug matches mask, searching contents...
Select-String : The file C:\Users\XXXXXXX\AppData\Local\Temp\debug cannot be read: Access to the path
'C:\Users\XXXXXXX\AppData\Local\Temp\debug' is denied.
At C:\Utils\WinSCP\Extensions\SearchText.WinSCPextension.ps1:78 char:30
+ ...         $matchInfo = Select-String -Path $tempPath -SimpleMatch $text
+                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Select-String], ArgumentException
    + FullyQualifiedErrorId : ProcessingFile,Microsoft.PowerShell.Commands.SelectStringCommand

Confirm
The item at C:\Users\XXXXXXX\AppData\Local\Temp\debug has children and the Recurse parameter was not specified. If you
 continue, all children will be removed with the item. Are you sure you want to continue?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
Thank you!

Error.jpg

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,853
Location:
Prague, Czechia

Re: Select-String : The file C:\Users\XXXXXXX\AppData\Local\Temp\debug cannot be read: Access ... denied

Is the /debug a file or a directory?

Reply with quote

SmurfnSurf

Re: Select-String : The file C:\Users\XXXXXXX\AppData\Local\Temp\debug cannot be read: Access ... denied

I’m pretty sure it’s a debug file generated by the router, so I think I see where you are going with the observation as it’s constantly growing/ being updated.

How do I exclude that file from the search?

Reply with quote

martin
Site Admin
martin avatar

Re: Select-String : The file C:\Users\XXXXXXX\AppData\Local\Temp\debug cannot be read: Access ... denied

No that's not where I'm heading. I believe it's a directory, not a file. Can you check?

Reply with quote

Guest

Re: Select-String : The file C:\Users\XXXXXXX\AppData\Local\Temp\debug cannot be read: Access ... denied

Hi again,

You're correct; it is a directory (on an ASUS Rt-AX88U Pro Router).
See attached. HTH?

Description: Contents of Slash Debug

Contents of Slash_Debug.jpg

Description: Debug Dir

Slash_Debug.jpg

Reply with quote

Advertisement

SmurfnSurf
Joined:
Posts:
5

Re: Select-String : The file C:\Users\XXXXXXX\AppData\Local\Temp\debug cannot be read: Access ... denied

See attached. I used Debug level 2.
I attach 3 logs, as the first one (Where I answered N to continue after the error, see picture) does not seem to have a lot, the other two more detail (I answered Y to continue and got a second error too).

Description: Error1 showing continue questions below it

Error1.jpg

Description: Debug Level

Logging.jpg

Description: Zip file with 3 logs

Reply with quote

SmurfnSurf
Joined:
Posts:
5

Re: Select-String : The file C:\Users\XXXXXXX\AppData\Local\Temp\debug cannot be read: Access ... denied

Sorry about that, steep learning curve!
Hopefully this is what you needed?
Description: Searchtext Log

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,853
Location:
Prague, Czechia

Re: Select-String : The file C:\Users\XXXXXXX\AppData\Local\Temp\debug cannot be read: Access ... denied

Thanks. So it's a symlink with a relative path to a directory.
WinSCP has problems with resolving the relative path. I'll look into it.
Meanwhile, you can try one of these:
  • It might work better with SFTP protocol (why are you using SCP?).
  • If you can, change the symlink to use an absolute path (/sys/kernel/debug).
  • Exclude the /debug from the search by adding |/debug to the file mask.

Reply with quote

SmurfnSurf
Joined:
Posts:
5

Re: Select-String : The file C:\Users\XXXXXXX\AppData\Local\Temp\debug cannot be read: Access ... denied

martin wrote:

Thanks. So it's a symlink with a relative path to a directory.
WinSCP has problems with resolving the relative path. I'll look into it.
Meanwhile, you can try one of these:

OK Thank you for looking into it, much appreciated.

martin wrote:


  • It might work better with SFTP protocol (why are you using SCP?)

From memory I couldn't log in to the (ASUS RT-AX88U Pro)) Router using SFTP. See error.
SCP just worked, so I always use that.

martin wrote:


  • If you can, change the symlink to use an absolute path (/sys/kernel/debug).

  • I am not sure I can do that, I am not keen on changing anything in the Routers OS sorry, just not experienced enough.

    martin wrote:


  • Exclude the /debug from the search by adding |/debug to the file mask.
  • OK, I can certainly do that thank you.

    Description: SFTP Error

    SFTP.jpg

    Reply with quote

    Advertisement

    You can post new topics in this forum