Tuesday, 3 November 2009

Create a character special device

I got a typical problem with my desktop while redirecting a script's errors to /dev/null .

sh:/dev/null : permission denied

when i did an ls on that , i have observed that /dev/null some how got touched as a regular file instead of a character special file.I did a google and found a command to create a character special after which my script started working.

Here is the tip:

root@localhost# mknod /dev/null c 1 3
root@localhost# chmod 666 /dev/null
That last command isn't a joke, that's really the permissions you
want, read and write for everybody .

Notes :

crw-rw-rw-    1 root     root       1,   3 May 11 21:08 /dev/null
^ ^ ^
this means /dev/null is a character special device (the leading 'c')
with major mode 1 and minor mode 3, what that means is except that it reads/writes 1 character at a time not blocks of data like disk drives.

No comments:

Post a Comment

Tweets by @sriramperumalla