?
Solved

Command line sharing on another computer

Posted on 2000-05-17
4
Medium Priority
?
173 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 200 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

719 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