User has write-only permissions on a file, unable to
vi but is able to
nano normally. How is this possible?
I was wondering what happens if you only have write-access on a file and this was how I tested it.
# cd /home/tester # cat hello.txt Hello World! # ls -l hello.txt -rw------- 1 root root 13 Nov 17 01:55 hello.txt # chmod o+w hello.txt # ls -l hello.txt -rw-----w- 1 root root 13 Nov 17 01:55 hello.txt # su tester $ cd ~ $ cat hello.txt cat: hello.txt: Permission denied $ nano hello.txt
For some reason,
nano is able to read the file (see screenshot). I've confirmed
vi is not. My original hypothesis is that having write only permission allows you to only append the file like
echo "Hello" > hello.txt.
(See this screenshot for the actual commands I ran.)
ls -l "$(type -p nano)" shows permissions
-rwsr-xr-x root root.