Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

What value can not be changed in /proc/sys?

echo "Windows" > /proc/sys/kernel/ostype
bash: /proc/sys/kernel/ostype: Permission denied

Why?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Because ostype don't have write permission:

ls -al /proc/sys/kernel/ostype
-r--r--r-- 1 root root 0 2011-02-25 05:20 /proc/sys/kernel/ostype

If file in /proc/sys/ have write permission, you can change values in it.

share|improve this answer

The real answer to this question is really to understand what the proc filesystem means. /proc isn't a real filesystem - it's a filesystem interface to system internals. When you're reading or writing things in /proc you aren't reading or writing to or from the disk - you're reading and writing directly into things lie kernel memory or device drivers.

Thus yes the basic answer to 'why can't I write to /proc/sys/kernel/ostype?' is that the file isn't writable. However, the more complete answer is that this particular file is presented to you as read-only because it wouldn't make any sense to change it. 'ostype' is an immutable property of a running system.

share|improve this answer
    
Phil: a lovely example of a "bigger picture" answer, informative, accurate and well-referenced. I commend it to the OP (and to others!). –  MadHatter Feb 25 '11 at 7:20
    
Aw thanks MadHatter. –  Phil Hollenback Feb 25 '11 at 8:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.