Solved

Command line sharing on another computer

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
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!
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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…

623 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