Question

I can access the client drive if they have admin rights using the below code (can create and write files) but what if the client machine does not have admin rights, how to access their machine drive using below code?

public static void main(String[] args) throws Exception { 
             String url = "smb://182.16.109.161/C$/"; 
             try { 
                     NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, "username", "password"); 
                     SmbFile dir = new SmbFile(url, auth); 
                     for (SmbFile f : dir.listFiles()) 
                     { 
                         System.out.println(f.getName()); 
                     } 
            } catch (Exception e) { 
                    e.printStackTrace(); 
            } 

    }
Was it helpful?

Solution

Simple answer:

You can't. If you don't have the permissions, you can't access it. The share c$ only exists for admins.

You can create a network share, with explicit permissions for the user "everyone"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top