Now, what if we want to give elliot permission to edit the file mysmurf without changing file ownership as we did before? Well! This is very simple; you can use the chmod command to change file permissions.
Let's first switch to the root user:
elliot@ubuntu-linux:/home/smurf$ su -
Password:
root@ubuntu-linux:~# cd /home/smurf
root@ubuntu-linux:/home/smurf#
Now you can add the write permission for others (everyone else) by running the command:
root@ubuntu-linux:/home/smurf# chmod o+w mysmurf
Here o+w means others+write, which means adding the write permission to others. Now do a long listing on mysmurf:
root@ubuntu-linux:/home/smurf# ls -l mysmurf
-rw-r--rw- 1 smurf developers 29 Oct 23 11:34 mysmurf
As you can see, others can now read and write rw- to the mysmurf file. Now, switch back to user elliot and try to add the line I am not smurf! again:
root@ubuntu-linux:/home/smurf# su elliot
elliot@ubuntu-linux:/home/smurf$ echo "I am not smurf!" >...