Friday, April 3, 2009

/dev/null Permission Denied Error

This was a problem i faced and found that /dev/null is is not a charector devide. This is causing failure for all messages which are directed to /dev/null.

$ cat ash > /dev/null
/dev/null: Permission denied.

$ ls -l /dev/null
-rw-r--r-- 1 root root 0 Aug 9 11:22 /dev/null


Solution:
The problem seems to be with the permissions of the /dev/null. This seems to be read only at the moment for you. Check this by logging in as root and listing it with the command:

ls -l /dev/null

You should see this if everything is correctly set:
crw-rw-rw- 1 root root 1, 3

If you get a different set of permissions like this maybe:
-rw-r--r-- 1 root root 1, 3

then you should (as root) delete the /dev/null with:
rm /dev/null

and recreate it (as root) again with:
mknod -m 0666 /dev/null c 1 3

(The device number according to the Kernel source in the documentation under Documentation/devices.txt supposed to be Major=1 und Minor=3)

Now, list the /dev/null again and you should see the permissions as above. Hope this helps & it worked for me..

20 comments:

  1. chmod 666 /dev/null should work, no need to remove and recreate.

    ReplyDelete
  2. Thanks for your post, would try that ..

    ReplyDelete
  3. Thanks a lot it worked for me ....

    ReplyDelete
  4. Man, you saved me, thank you!

    I wasn't able to connect via sftp connection and there was nothing talking about my problem.

    I've noticed this error when I was connecting to my server via ssh connection and I thought of searching for this problem, and when I applied your solution, voila... I can now connect via stfp connection :)

    I know what caused this problem, I was searching in the internet for a way to know my server's internet connection speed, and I tried the following command:

    wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip

    Of course don't try this one :)

    ReplyDelete
  5. Good to know that this helped you mate.

    Cheers.

    ReplyDelete
  6. Hi,

    I am also facing the same issue with /dev/null and provided solution is working for me too.
    But how can we fix this issue.

    Thanks.

    ReplyDelete
  7. this helped me and i was able to continue with my work :) thanks a lot for sharing :)

    ReplyDelete
  8. Is there any reason why this occurs?

    ReplyDelete
  9. Thank you Ash, this helped me too. Now trying to figure out why the permissions on /dev/null were changed.

    Best,
    Pedro

    ReplyDelete
  10. Thanks, man! Really, this is awesome! =D

    ReplyDelete
  11. Thanks very much, useful.

    ReplyDelete
  12. I have permissions as crw-rw-rw- 1 root root ,3 and logged in as root
    still it shows as permission denied

    ReplyDelete
  13. @Justin L. Franks..
    chmod 666 /dev/null should work, no need to remove and recreate.

    This is working fine... Thanks for you help

    ReplyDelete
  14. I set a config option in my.cnf (mysql) to log-errors to /dev/null and this seemed to cause the folder to be recreated by mysql (had mysql owner and group). Removed the offending option, restarted mysqld service. Removed and recreated as noted in original post and the errors vanished. Thank you.

    ReplyDelete
  15. I think you need to restart the server after you recreate the file

    ReplyDelete

The Azure Synapse Resource Provider Error

  If you are get the error " The Azure Synapse resource provider (Microsoft.Synapse) needs to be registered with the selected subscript...