Granting share access permissions from DOS prompt

Granting share access permissions from DOS prompt

Post by dev_pro » Thu, 28 Jun 2007 21:24:15

Hi Gurus,
I was wondering if anyone knows the DOS command to grant/revoke file
sharing permissions of a shared folder.
Basically, I would like to share my USB key on the work network so
that I can access it on any work PC. Every morning, after plugging the
key, it takes (say) drive X:. I then share this as X$ and specify
permissions to my account following a sequence of right-clicks and
entering the names.
I'm hoping if this can be done by a DOS batch file or a VBS script, so
one can do the whole lot by just double-clicking this icon.
In regards to the sharing, it can be done using the NET SHARE dos
command but I don't know how to specify the access permissions as a
dos command.
If anyone has ever touched this area, it will be appreciated to
receive your recommended solution.


Granting share access permissions from DOS prompt

Post by MV » Thu, 28 Jun 2007 21:39:00

Current usage says that DOS is an operating system. It does not
exist under Windows XP. Your aim is to change permissions
with a "command line".

To make drive X: available to other users, share it as "USBKey"
instead of X$.

AFAIK, the command "net share" will set permissions only on
a Windows 2003 server but not under WinXP. Instead of setting
***share*** permissions, consider setting ***NTFS***
permissions. They can be set with cacls.exe. This implies that
you convert your USBKey from FAT to NTFS, using convert.exe.

You need to set NTFS permissions once only. They become
part of the file system.

Post again if you require more detailed instructions.


Granting share access permissions from DOS prompt

Post by Mike Lower » Thu, 28 Jun 2007 23:27:49

You can set NTFS permissions using CACLS. Not sure about share permissions.