Closed bacicrajko closed 3 years ago
Hi, client.ReadDir
returns []os.FileInfo, error
can you please check the error? If not nil it could contain useful information (maybe a permission issue in your case)
Indeed, it’s not uncommon for /var/logs/*
to be root only read:
drwx------ 1 root root 368 11. Apr 13:13 YaST2
In this case, attempting to ReadDir
from that directory would result in a permission denied result for any user other than root.
@drakkan @puellanivis thank you for your responses. The error I'm getting is always: file does not exist
However based on your comments I tried with a different user and now I can list the directory, but its rather strange that I didnt get different error
@bacicrajko .. The error returned is up the the SFTP server. It might be returning file not found as a security feature, so you can't look for files on the system by checking for permission issues.
If the issue still persist, please reopen providing more info and a way to reproduce, thank you
Hi, I am not sure if this is a problem with library or in my code. When I open a sftp connection current directory is set as /home/myuser Passing path to client read dir does not return any results. client.ReadDir("/var/logs/node1") does not return any files. Only directory that I can read is the one I am currently in (/home/myuser)