Solved

Command line sharing on another computer

Posted on 2000-05-17
4
164 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
  • 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now