UnixDroid

Intermediate · 5 missions

Users & permissions — Linux terminal practice

Read rwx permissions, make scripts runnable, protect private files and check your user and groups.

student@unixdroid: ~

Missions in this track

rwx permissions, chmod aur apne files ko private rakhna.

  1. 1

    Read permissions

    Show the permissions of the files in ~/scripts.

    Show the command
    ls -l ~/scripts

    -rw-r--r-- = owner can read+write, group and others can only read.

  2. 2

    Make it runnable

    ~/scripts/backup.sh is not executable. Give it execute permission.

    Show the command
    chmod +x ~/scripts/backup.sh

    Without the x bit you get "Permission denied" when you try to run a script.

  3. 3

    Run it

    Run the backup script.

    Show the command
    ~/scripts/backup.sh

    ./file means "the file in this folder". Linux does not look in the current folder by itself.

  4. 4

    Keep it private

    Make ~/notes/todo.txt readable and writable only by you (600).

    Show the command
    chmod 600 ~/notes/todo.txt

    r=4, w=2, x=1. 600 = rw for owner only. SSH keys must be 600 or ssh refuses to use them.

  5. 5

    Your groups

    Show your user id and the groups you belong to.

    Show the command
    id

    Being in the sudo group means you can become root.