Created
October 13, 2014 16:11
-
-
Save paulghaddad/5fe0e09a3bbedc9778af to your computer and use it in GitHub Desktop.
Level Up 1: Understands Unix file permissions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Use touch to create a new file in the /tmp directory. What permissions do user / group / and world have to that file by default? | |
cd /tmp | |
touch new_file.txt | |
# The permissions of user, group and world are: | |
user: read, write | |
group: read | |
world: read | |
2. Use chown to change ownership of that file to the root user and root group. | |
Ask the group about this one | |
sudo chown root new_file.txt | |
# illegal group name for the root group on Macs, but this will work on Linux: | |
sudo chown :root new_file.txt | |
3. So that we can continue to use it, use chmod to grant read and execute permissions to everyone for that file using the 'absolute' syntax. | |
sudo chmod 755 new_file.txt | |
4. We also want to remove the ability for the root group to write the file. Use the 'symbolic' syntax to remove that permission. | |
sudo chmod g-w new_file.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment