I would like the user to have full rights on this folder (as well as all sub-directories and files in it):

  1. Share Folder Through Command Line
  2. Ntfs Share Permissions
  3. Event Viewer

currently owned by root.

Cacls.exe, a command-line utility available in both Windows XP Professional and Home Edition, provides another way to view and edit permissions. With Cacls (short for Control ACLs), you can view existing permissions by typing cacls filename at a command prompt, replacing filename with the name of the file or folder you're interested in (wildcards are acceptable as well). We can use net share command from command line to create, configure. /grant:username,permissions sharename: You can assign name to the share you are. Whom you want to share the folder with permission: Read, Change or Full. Recently I received the question via email — “How do I change user rights under UNIX? I am using Red Hat Enterprise Linux and my background includes Windows network” Adblock detected 😱 My website is made possible by displaying online advertisements to my visitors. Ads are annoying but they help keep this Continue reading 'Unix or Linux commands for changing user.

I have found numerous posts (in this forum and elsewhere) on how to do this for files but I can't find a way to do it for whole folders.

user2413
user2413user2413
4,24813 gold badges41 silver badges65 bronze badges

6 Answers

Share Folder Through Command Line

Make the current user own everything inside the folder (and the folder itself):

Zanna
52.2k14 gold badges145 silver badges246 bronze badges
Lucian Adrian GrijincuLucian Adrian Grijincu
2,9602 gold badges15 silver badges15 bronze badges

Autocom delphi 2016.00 keygen released. Use chown to change ownership and chmod to change rights.

As Paweł Karpiński said, use the -R option to apply the rights for all files inside of a directory too.

Note that both these commands just work for directories too. The -R option makes them also change the permissions for all files and directories inside of the directory.

For example

will change ownership (both user and group) of all files and directories inside of directory and directory itself.

will only change the permission of the folder directory but will leave the files and folders inside the directory alone.

As enzotib mentioned, you need to use sudo to change the ownership from root to yourself.

Edit:

Note that if you use chown <user>: <file> (Note the left-out group), it will use the default group for that user.

If you want to change only the group, you can use:

IkkeIkkeLine
7,0582 gold badges12 silver badges10 bronze badges

If you prefer, this can be done with a GUI as well. You will need to open Nautilus as root to do so. Press Alt + F2 to access the 'Run Applications' dialog and enter gksu nautilus

Next, browse to and right click on the folder you would like to modify. Then, select 'Properties' from the context menu. You can now select the user or group that you would like to be the 'Owner' of the folder as well as the permissions you would like to grant them. Finally, press 'Apply Permissions to Enclosed Files' to apply the changes recursively.

Though it seems this does not always work for some operations in a deep folder tree. If it does not work use the appropriate terminal command.

Ntfs Share Permissions

Tshilidzi Mudau
3,7843 gold badges20 silver badges28 bronze badges
andrewsomethingandrewsomething
27.7k11 gold badges77 silver badges135 bronze badges

If it's owned by root you can do this

Since ./blabla owned by root you need to gain root privileges to change that. That's what sudo will do. The -R option for the chown command says: this directory and everything in it recursively.

AndyBAndyB
PawełkowyPawełkowy
5,2485 gold badges29 silver badges49 bronze badges

First chmod -R can mess up your system permissions if you do it on system file and directories by mistake.

Second chmod -R can mess up flags in those folders and is not a good idea to give permissions on some folders to all the users.

You should try and chown instead:

Eduard FlorinescuEduard Florinescu
2,4778 gold badges32 silver badges45 bronze badges

protected by CommunityFeb 21 '14 at 7:21

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged command-linepermissionsfolder or ask your own question.

This is sort of a two-pronged question.

I am developing an application that will need to be able to create network shares in Windows Server 2003 via the command line. So, firstly, how do I create shares in Windows via the command line? I tried researching it, and all I was able to find is that I should be using net, but other than that, there isn't much documentation.

Also, in this share there will be a few directories with the names of users on the domain, and I would like for the directories to not be readable or writable by anyone else. For example, say I have two directories: jsmith and jdoe. I would like the user jsmith to write and read from the directory jsmith, but not the directory called jdoe, and vice versa.

Derek MacielDerek Maciel

2 Answers

This should be the information that you are looking for:

You can also remove permissions, or edit permissions on the directory using cacls.exe. My recommendation would be to read up on cacls.exe

Cacls

or just 'cacls /?' from the command line should work as well.

matrixx333matrixx333

Event Viewer

The command you're looking for is net share. The /? help on the command is pretty straightforward, but here is an example:

As far as security goes, from what I've read, the best-practice is to do as above, grant the Everyone group full control on the share, and then manage the permissions on the files and folders themselves. This is because the share permissions are a restriction filter over top of the actual file and folder permissions.

Jon SeigelJon Seigel
1981 gold badge2 silver badges10 bronze badges

Not the answer you're looking for? Browse other questions tagged command-linenetwork-shareswindows-server-2003 or ask your own question.