-1

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(); 
            } 

    }
Christian Kuetbach
  • 15,850
  • 5
  • 43
  • 79
pise
  • 849
  • 6
  • 24
  • 51
  • What's not "working"? Specific error message? What permissions exactly does the user have on the relevant objects? – chrylis -cautiouslyoptimistic- Sep 09 '13 at 17:27
  • `C$` is an administrative share. unprivileged users will **NOT** have the rights to use it. – Marc B Sep 09 '13 at 17:29
  • @chrylis user does not have admin right. I have googled and in windows there are three type of account admin,limited and guest. But in this scenario user is not guest and admin. – pise Sep 10 '13 at 17:39
  • @MarcB, how to access client drive if he is not logged in as administrator – pise Sep 10 '13 at 17:40
  • explicitly share out the required folder and grant that specific user rights on the folder **AND** the share. – Marc B Sep 11 '13 at 14:31

1 Answers1

0

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"

Christian Kuetbach
  • 15,850
  • 5
  • 43
  • 79