I thought:
echo hello world > /usr/bin/firefox
would display the message in the browser. Nothing happened. Then I tried:
echo hello world > /usr/bin/kwrite
to see if kwrite opens with 'hello world' typed ahead. Again, nothing happened. Then after trying to execute both commands:
computer:~$ kwrite
/usr/bin/kwrite: line 1: hello: command not found
computer:~$ firefox
/usr/bin/firefox: line 1: hello: command not found
Doing ls -l /usr/bin/:
-rwxr-xr-x 1 root root 182576 2012-08-21 06:42 apt-ftparchive
-rwxr-xr-x 1 root root 116996 2012-08-21 06:41 apt-get
-rwxr-xr-x 1 root root 2151596 2011-10-20 21:45 aptitude
-rwxr-xr-x 1 root root 1939 2011-10-20 21:45 aptitude-create-state-bundle
-rwxr-xr-x 1 root root 3007 2011-10-20 21:45 aptitude-run-state-bundle
-rwxr-xr-x 1 root root 7336 2012-08-21 06:41 apt-key
lrwxrwxrwx 1 root root 20 2012-12-29 10:41 /usr/bin/firefox -> /opt/firefox/firefox
-rwxr-xr-x 1 root root 5476 2010-11-17 04:58 /usr/bin/kwrite
-rwxr-xr-x 1 root root 181104 2010-02-16 01:40 zip
-rwxr-xr-x 1 root root 1184 2011-01-21 23:49 zxpdf
The binary files in /usr/bin (and other bin folders) on my system, had at least the user write permission on (?). So what I effectively did was write to the executables 'hello world', although /usr/bin/kwrite was a binary exec while /opt/firefox/firefox was a shell script
So it's clear that executable files are prone to this type of accident. So I want to ask if the write permission is even necessary. I want to turn it off however I want to make sure I am not missing something here.
