0

I have a folder named Dog with these permissions:

dr--r-- 2 rich boys 4096 

What is the shell command for it

Ahhhhh
  • 59
  • 2
  • 4
  • "What is the shell command so that I can grant group traversal rights on this folder?" is missing the most important thing: for WHO? You already can, group can't and others can't. – Rinzwind Mar 28 '19 at 11:54
  • 1
    @Rinzwind "What is the shell command so that I can grant *group* traversal rights on this folder?" – Melebius Mar 28 '19 at 12:30
  • @Melebius there was a comment above mine that already stated this. From steeldriver iirc. – Rinzwind Mar 28 '19 at 14:18
  • Has any of the answers solved your problem? Please accept it (✓) or clarify your needs using [edit]ing or comments. You can also upvote (▲) useful answers. – Melebius Apr 08 '19 at 06:08

2 Answers2

4

The command is:

chmod g+x Dog

For opening the folder, you need the execute permission. (When used on regular files, the same execute permission allows running them.) This command simply sets it to the group without touching other permissions.

Further reading

Melebius
  • 11,431
  • 9
  • 52
  • 78
-1

To give all rights (read, write and execute) to the owner and group; and no rights to others, run this command:

sudo chmod -R 750 ./Dog

Example:

cd /tmp
mkdir Dog
ll | grep Dog
    drwxr--r--  2 subroot subroot  4096 Mar 28 13:49 Dog/
sudo chmod -R 750 ./Dog
ll | grep Dog
    drwxrw----  2 subroot subroot  4096 Mar 28 13:49 Dog/
Parto
  • 15,325
  • 24
  • 86
  • 117
  • Technically correct but 777 is never really needed. 770, 775, 750, 755 are more safe options. 777 is for instance useful with the sticky bit option /tmp/ uses: files can be accessed if owned by that user or root – Rinzwind Mar 28 '19 at 11:55
  • @Rinzwind Just realized that and corrected in time. – Parto Mar 28 '19 at 11:56
  • 1
    for group traversal rights 750 would be enough. – pLumo Mar 28 '19 at 12:10
  • You should not set 770 recursively. Among others, it means setting the execute permission for all regular files (in addition to folders) which is likely not desired. – Melebius Apr 02 '19 at 08:32