

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: Users
incomplete
2: Whoami and sudo
incomplete
3: Permissions
incomplete
4: Changing Permissions
incomplete
5: Making a Script Executable
incomplete
6: Root User
incomplete
7: Chown
incomplete
8: Using sudo
incomplete
This lesson's interactive features are locked, please to keep using them
So when do you need to use sudo? chmod allows you to change the permissions of any file or directory that you own. But what if you don't own the file or directory? That's where sudo is required. Let's change ownership of a directory to see how that works.
The chown command, which stands for "change owner," allows you to change the owner of a file or directory, and it requires root privileges.
Hmmm, it seems like it has some personal contact info for employees. We don't know whose this is, but we're pretty sure it should have its access strictly limited.
sudo chown -R root contacts
Here's an explanation of the command:
sudo – Run as the root userchown – Command to change the owner-R – "Recursive," meaning also apply the changes to everything inside the directoryroot – The name of the new ownercontacts – The directory to change the owner ofYou might be prompted for your password. Enter it.
ls -l
Find the line from the output that represents the contacts directory. Copy the whole line into the input field and submit your answer.