folder permissions in Linux

I want to create a folder , then  give Read and Execute permissions to a group. what 's the right command?

for instance.

I create a folder named Marketing, then give MarketingGroup Read/Execute permissions, no one else will have permissions on this folder.

Thanks
jskfanAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Archzilon Eshun-DaviesCommented:
FIrst create the directory

mkdir <folder>

Open in new window


using Marketing as example
mkdir Marketing

Open in new window


normally the default permission after creating a directory is 0755 but you can double check
to be safe by applying the permission
chmod 755 <folder>

Open in new window

using Marketing as an example it'll become
chmod 755 Marketing

Open in new window


and then change the owner of the directory as follows
chown :<group> <directory>

Open in new window

and again using the Marketing as an example it would be come
chown :MarketingGroup Marketing

Open in new window

0
jskfanAuthor Commented:
chown :MarketingGroup Marketing

I thought the command above will give ownership of the Marketing folder to MarketingGroup, which means x7x

in my case I need to give folder creator , ownership, which is Read/write/Execute,  the MarketingGroup will have Read/Execute, and anyone else nothing

if I am understanding Linux permissions at all:

XYZ: means user X si the folder creator, automatically will have Read/Write/Execute
user Y, is the group name that we will give permissions to the folder, Z is the rest of the users
0
Reza_aCommented:
chgrp marketing foldername
chmod g=rx foldername
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Dave GouldOnsite SupportCommented:
The example from Laudarch opens the folder to others.

mkdir marketing                                # this will create the folder
chgrp marketinggrp marketing       # This will make the group marketinggroup the group                                                                          owner
chmod 750 marketing                       # owner=rwx, group=r_x, others=no access
0
jskfanAuthor Commented:
trappa01:
would not this command give ownership to MarketingGroup? which means R+W+E

chgrp marketinggrp marketing       # This will make the group marketinggroup the group                                                                          owner
0
Dave GouldOnsite SupportCommented:
No. Imaging that dave is a member of the group admins and he creates a directory called marketing

mkdir marketing
the directory marketing will look something like this (ls -l):
_rwxr_xr_x dave admin marketing     In other words the owner is dave and he has rwx, the group is admin and they have r_x and others also have r_x

dave then types
chgrp marketinggrp marketing      
so now the directory looks like this:
_rwxr_xr_x dave marketinggrp marketing         In other words, dave is still the owner and still has rwx, the members of the group marketinggrp now have r_x as do any others.

So now we need to make sure that the others dont have any access:
chmod 750 marketing                        
so now the directory looks like this:
_rwxr_x_ _ _ dave marketinggrp marketing       dave = owner (rwx) members of marketinggrp have r_x and others have _ _ _ (ie no access)

I hope this is clear
0
jskfanAuthor Commented:
chgrp marketinggrp marketing  
I see that Chgrp, does not give permission to marketing folder, it just assigns the folder to MarketingGroup, before you give it permissions with Chmod.

Chgrp is like you are telling MarketingGroup "Catch the Marketing" folder , I will tell you what you can do with it.

Chmod, will tell the MarketingGroup what they can do with the folder

I could be wrong
0
Dave GouldOnsite SupportCommented:
"I could be wrong" .... but then again....you could be right.

The important thing to keep in mind is that with linux files and folders, we can give 3 levels of access.
1. We can give rights to the owner (a single person) of the file (usually maximum rights)
2. We can give slightly less or different rights to a group of named people. We add these people to a group and assign rights to the group.
3. We decide how anybody else (ie not the owner and not a member of the group) can access the file. Quite often this will be read or execute only .

The file itself has an owner. This is often the person that created the file but I can create a file and designate somebody else as owner with the command chown.
The file belongs to a group too. This is usually the file creators principal group but can be modified using the chgrp command.

The command used to define the levels of access for the owner, group and others is chmod.
0
jskfanAuthor Commented:
in Windows , you add the group to Access list, then you give the group permissions…

Chgrp groupname Foldername
seems to me like adding the group to ACL
Chmod 750 Foldername is giving permissions to the group specified with Chgrp
0
Dave GouldOnsite SupportCommented:
True but dont forget that in windows you can add as many groups as you wish to a file access list. In Linux, you only add one.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jskfanAuthor Commented:
Thank you Guys!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.