I Have a query. In one of my server I just came to know that there was /dev/null file which is a not a character file. Its just a normal file. I know the command to create the character file (/dev/null) but what is the procedure. Like should i delete /dev/null and create or anything else. I have a doubt that we can't remove /dev/null right ?
Expected format:
crw-rw-rw- 1 root system 2, 2 Feb 25 15:13 /dev/null
Format in my server:
-rw-rw-rw- 1 root system 0 Feb 25 15:22 /dev/null
Take my advice with a grain of salt since I'm not an AIX expert, but: Having a /dev/null that is not a character device could be a big problem, yes! Things might create huge files in it, expecting them to go into the bit bucket, but actually ending up on disk instead... Some memory mapping things might not work right... etc.
You're generally not supposed to delete anything in /dev/, no. But when things are messed up like this, don't know what else you're supposed to do.
See those numbers there, 2,2? They're what make /dev/null act like /dev/null and not be some other device. You give those to mknod when you create it, and also give it c to tell it it's a character device and not a block one.
Last edited by Corona688; 02-25-2013 at 11:51 AM..
Disclaimer: I have never used AIX. Everything I say below is based on the OP's statement that /dev/null is a regular file.
Quote:
Originally Posted by Corona688
Take my advice with a grain of salt since I'm not an AIX expert, but: Having a /dev/null that is not a character device could be a big problem, yes! Things might create huge files in it, expecting them to go into the bit bucket, but actually ending up on disk instead... Some memory mapping things might not work right... etc.
Although a less common scenario, there are times when using /dev/null for reading is useful. One example that comes to mind is with grep, to force its output to include filenames, you may explicitly list /dev/null in a find -exec predicate or an xargs invocation, to ensure that grep is never called with a single file argument. If /dev/null does not yield nothing but EOF ... woe.
Location: on the road for work; home is private time
Posts: 456
Thanks Given: 10
Thanked 108 Times in 100 Posts
I think a more AIX way of recreating /dev/null on AIX is:
I would be curious to know how it became a character file (implies someone with write perms on /dev removed it, and the first person to write to /dev/null (would be the new owner) recreated it as a regular file. I would expect that there is a script being run by root that is deleting it, and writing it again. Since you show 0 bytes, it is also being truncated as well.
So, your second security issue is when is it being removed? If you cannot answer this, the issue will come back and haunt you.
This User Gave Thanks to MichaelFelt For This Post:
Was/is the file really "/dev/null" or is it rather "/dev/nulll" (3 "l"s!) ? The latter is a residue of some typo in an AIX script, i believe. I have seen it at various customers even in newly installed systems, so i suppose some IBM script, maybe in the HACMP installation procedure, is the culprit.
Real worls example of /dev/null usage with grep on HPUX systems, where grep lacks option to show filename where grep has matched the result.
Sorry for the offtopic.
Hello
Can I just remove/delete flile ?
rw-r--r-- 1 root system 2385088512 Jun 30 21:25 /dev/null 2>&1
size of this flile is 2274.75 m and fill up my filesystem:
Filesystem MB blocks Used Free %Used Mounted on
/dev/hd4 2560.00 2558.59 1.41 100% / (10 Replies)
I apologize if this question has been answered else where or is too elementary.
I ran across a KSH script (long unimportant story) that does this:
if ; then
CAS_SRC_LOG="/var/log/cas_src.log 2>&1"
else
CAS_SRC_LOG="/dev/null 2>&1"
fithen does this:
/usr/bin/echo "heartbeat:... (5 Replies)
Hi,
I'm currently using the following command to wipe clean a log file which can't be straight out RM'd:
cat /dev/null > server.log
I'm building this into a script and I'm current working on a command to run on each machine to do this automatically however I have multiple files so I need... (11 Replies)
How are these two different? They both prevent output and error from being displayed. I don't see the use of the "&"
echo "hello" > /dev/null 2>&1
echo "hello" > /dev/null 2>1 (3 Replies)
Hi, Anyone can help
My solaris 8 system has the following
/dev/null , /dev/tty and /dev/console
All permission are lrwxrwxrwx
Can this be change to a non-world write ??
any impact ?? (12 Replies)
when i write the following two statements :
cp /dev/NULL /clocal/mqbrkrs/user/mqsiadm/sanjay/dspmq_temp
cat /dev/NULL > /clocal/mqbrkrs/user/mqsiadm/sanjay/dspmq_temp
its gives me errors like :
cp: /dev/NULL: A file or directory in the path name does not exist.
cat : /dev/NULL can't open... (2 Replies)
Please help urgently.
I need to setup up some sort of service on a solaris server on a port.
I dont need it do anything special, anything that is sent to this port from an external server should be dump to /dev/null or a flat file..
Can you help urgently? (1 Reply)
Hi,
Q1-What does
nroff -ms > /dev/null
Q2- What does mean -A under STAT column :
ps aux |head -20
UTIL PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
root 516 93,0 0,0 12 12 - A 04 nov 3906:51 wait
Thank you. (4 Replies)
First of all, hello there cOmMuNity ! :cool:
Well, I've got two basic questions:
1) In how many ways it's possible to create a file ?
I know one manner using "touch", other typing something like echo "" > file ...
The fact is that I need to overwrite the file if it exists, and touch... (8 Replies)
hello all,
I am working in a Hpux 11.0 64 bit environment. I am not sure if a third party software is doing this or not, but the admin to this server says it is not a server issue as he has check and double check logs and crons to verify this issue. My problem, is that every now and then, once... (4 Replies)