Change Ownership Of Linux Directory

1

I Have a Netgear ReadyNAS and have set up SFTP on it.
I created a user named "newuser" and changed directory to "newdirectory".

If I run the command chown newuser * -R inside of "newdirectory", will this change file ownership only on this directory?

bob666

Posted 2015-04-17T00:03:44.370

Reputation: 13

Answers

1

Running any command in bash, using the asterisk *, causes the shell to select all files and directories in the folder you are in right now. The -R flag will make sure the subdirectories and subfiles are modified aswell. Be aware, that the directory where you are itself will not be modified. If you want to modifiy the current folder, you should use the dot ..

Summary:

$ cd newdirectory/
$ chown newuser * -R
├─ newdirectory/     # not modified
│  ├─ subdirectory/  # modified
│  │   └── subfile/  # modified
│  └─ file           # modified

$ cd newdirectory/
$ chown newuser . -R
├─ newdirectory/     # modified
│  ├─ subdirectory/  # modified
│  │   └── subfile/  # modified
│  └─ file           # modified

erikgaal

Posted 2015-04-17T00:03:44.370

Reputation: 502