0
0
Linux CLIscripting~20 mins

chmod (change permissions) in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
chmod Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of ls -l after running chmod 754 file.txt?
You have a file named file.txt. You run the command chmod 754 file.txt. What will be the permission string shown by ls -l file.txt?
Linux CLI
chmod 754 file.txt
ls -l file.txt
A-rwxr-xr-- 1 user group 0 date file.txt
B-rwxr-xr-x 1 user group 0 date file.txt
C-rwxr--r-x 1 user group 0 date file.txt
D-rwxr--r-- 1 user group 0 date file.txt
Attempts:
2 left
💡 Hint
Remember the digits in chmod represent owner, group, and others permissions in octal.
💻 Command Output
intermediate
1:30remaining
What error occurs when running chmod 999 file.txt?
You try to set permissions with chmod 999 file.txt. What happens?
Linux CLI
chmod 999 file.txt
Achmod: cannot access 'file.txt': No such file or directory
BPermission changed successfully
Cchmod: invalid mode: ‘999’
Dchmod: invalid argument ‘999’
Attempts:
2 left
💡 Hint
Check if the mode digits are valid octal numbers.
📝 Syntax
advanced
1:30remaining
Which command correctly adds execute permission for the group on script.sh?
You want to add execute permission for the group only, without changing other permissions. Which command is correct?
Achmod g+x+ script.sh
Bchmod +x g script.sh
Cchmod x+g script.sh
Dchmod g+x script.sh
Attempts:
2 left
💡 Hint
The syntax is chmod [who]+[permission] file.
🚀 Application
advanced
2:00remaining
How to set permissions so owner has full access, group has read-only, and others have no access on data.txt?
You want data.txt to have these permissions: owner can read, write, execute; group can only read; others have no permissions. Which command achieves this?
Achmod 740 data.txt
Bchmod 700 data.txt
Cchmod 754 data.txt
Dchmod 744 data.txt
Attempts:
2 left
💡 Hint
Convert permissions to octal: rwx=7, r--=4, ---=0.
🧠 Conceptual
expert
2:30remaining
What is the effect of chmod u=rwx,g=rx,o= file.txt?
You run chmod u=rwx,g=rx,o= file.txt. What permissions does file.txt have?
AOwner has read and write; group has read only; others have execute only
BOwner has read, write, execute; group has read and execute; others have no permissions
COwner has full permissions; group and others have full permissions
DOwner has no permissions; group has read and execute; others have read only
Attempts:
2 left
💡 Hint
Look at each user class and the permissions assigned explicitly.