- So our next assignment is about users and permissions.
What do we need to do?
We need to set defaults for new users
such that passwords have a maximum validity.
Then when creating new users, we copy an empty file
with the name 'data' to their home directory.
We need to create users, Anna and Anouk
and set secondary group membership to profs
and users Linda and Lisa and set their
secondary group membership to students.
You know what?
Let me start with that because the remaining
three tasks, these are more on the permission side.
These four tasks are more about the users.
So let's get this out of the way
before we have a look at permissions.
So password validity, that is in ETC login dot defs.
And there we go, past max days
is the parameter that I'm looking for.
By default it's set to 99,999.
That's much, let's set it to 90.
Then second assignment, when creating new users
copy an empty file with the name 'Data'
to their home directory.
Let's obtain through ETC skel.
I'm using touch data and that'll pick it up.
Then we need to create users Anna and Anouk
and set secondary group membership.
And likewise for Linda and Lisa.
You know what, I'm starting group add
profs and group add students.
That makes it so much easier.
And then I can use user at Anna minus G profs.
And for Ubuntu users, don't forget minus M
to create a home directory as well.
I'm ignoring this message here, 'user Anna already exists.'
That's okay.
As I told you, it's just because I pre-used the system.
As long as the commands are alright
we shouldn't make it more complicated than necessary.
So user add Lisa minus G students minus M,
and likewise for user Linda.
Oh, there is one thing by the way,
user Anna already existed.
Let's do ID on Anna and we need to do that for Lisa as well.
And we can see the user Anna is now
not a member of the group profs.
So user mod minus AG profs on Anna
and let's do something similar for user Lisa.
And now we are alright.
Okay, that took care of the part of the users.
Now I want to read the rest of it.
So we need to create a directory 'data profs'
as well as the directory 'data students.'
Let's immediately do that.
MKDR minus P slash data profs, data students.
And ensure that members of the group
'students' have full access to data.
Students and profs have full access to data profs.
Let me get into data and let me use CHGRP profs
on profs and CHGRP students on students.
And at least CH mod G plus W on star.
LS minus L, now we have taken care
of this part of full access.
Alright, so here is the second part of the permissions
related assignments, where we need to ensure that new files
in the directories are automatically group owned
by the group owners of the directories.
And users should only be allowed to delete their own files
in these directories, with the exception of user Anna
who should be able to delete all files.
So now we need to make sure that new files
in these directories are automatically group owned
by the group, by the group owners of the directories.
Hey, I know how to do that.
That is CH mod G plus S.
That's a set group ID bit.
On star.
I'm ignoring the fact that there are sils.
Sils is not important.
What is important is that now we can see
that on the position where before we had
an X for group execute, we now have S for set group ID.
Last requirement is that users should only
be allowed to delete their own files in these directories
but Anna should be able to delete all files.
So I need CH own Anna on profs to make her owner
and likewise for students.
And then I can use CH mod plus T on these directories.
So what is this?
This is sticky bit and sticky bit makes
that you can only delete files
if you are the owner of the file,
if the directory contains sticky bit.
And the exception?
If you are the user owner of the directory
now you can also delete files.
And that's done.
So that's what we needed to do for this assignment.