Solved

Command line sharing on another computer

Posted on 2000-05-17
4
171 Views
Last Modified: 2013-12-28
I was just wondering if there was a way to share a folder on another machine from the command line.  Explorer doesn't seem to let you, but the old File manager (winfile) does.  I need to do this from the command line though.  I tried several methods including UNC path and mapping a drive to the other computer.  For instance:
net share myshare=\\myserver\e$\mydir
and
net share myshare=f:\mydir
neither of which worked.  Is there another way to get around this?  
What I'm trying to do is simply automate some folders and shares we create when we make a new user here.  I'm going to be doing this with Perl and would rather avoid using the Perl NT module if at all possible.  I've had nothing but problems with that.  
The other part of the question is, is there a command line way to control the share permissions and the regular directory permissions as well?  
Thanks for the help in advance.  :)
=blain
0
Comment
Question by:timberbt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Expert Comment

by:bigkeith
ID: 2818654
I think the command line syntax you are looking for is:

net share share-name[=path] [options]

Make a directory available to the network or revoked shared access (the =path form is used only when defining a new shared resource).

Without arguments, the command lists all current shared resources. If just a share name is specified (without options), information about the resource is displayed.

Hope this helps!
0
 
LVL 1

Author Comment

by:timberbt
ID: 2826323
Not quite sure I follow what you're saying here....
I was originally doing the following:
net share testshare=\\server1\e$\test

Where we have testshare being the sharename, and the path to the directory I want to share being designated by the UNC path above.  I want to create a new share.  The directory is previously unshared.  

I get the following:
if I first do a net use and map a drive to a base share (something above the directory I want to share in the structure) I get "The resource named cannot be shared." and it gives me a helpmsg of 3736 which doesn't help at all.  If I do it with the UNC code it simply gives me the syntax statement so it really seems to dislike the UNC path.  

I hope that makes it more clear.
=blain
0
 

Accepted Solution

by:
jwaterson earned 50 total points
ID: 2851039
You need the rmtshare.exe utility from the Resource Kit. You would use it like this:

rmtshare \\myserver\newshare=e:\mydir

You can also grant permissions on the share. To give user jbloggs Full Control of the share you would add the following to the above command:

/g bloggsj:f

You can remove permissions too. See the rktools.hlp file in the Resource Kit for full documentation.

To edit the actual NTFS permissions on the folder, you need to use another utility called cacls.exe. This is included in the core OS and doesn't require the Resource Kit. The syntax is quite involved so I won't give examples, but running cacls /? should sort you out.

Cheers,

J.
0
 
LVL 1

Author Comment

by:timberbt
ID: 2921127
Answer accepted
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question