Sponsored Content
Full Discussion: Wrong 'uname' )
Top Forums UNIX for Dummies Questions & Answers Wrong 'uname' ) Post 302101663 by Perderabo on Wednesday 3rd of January 2007 05:47:56 PM
Old 01-03-2007
First, I have to say that this thread has me worried a little bit. Why do you want the uname command to output the wrong info?

The uname command typically resides in /bin or /usr/bin and it obtains information by invoking the uname(2) system call. Here is the man page for the Solaris uname command. Note that, as iamcollins mentions, there is support for using the SYSV3 environment variable to override the values returned by uname(2). I have only seen this feature on Solaris. If anyone sees it on another OS, please respond to this thread and tell us the OS.

Both the uname command and the uname function are part of the posix standard. But Posix does not strongly limit what info is returned. The various uname versions had differly too widely for any consensus to be reached.

The root user can certainly replace the standard uname command. If root replaces the uname command with, say, the famous, "hello world" program, then "uname -a" will return "hello world". And you can create a slightly more complex replacement command as well. It could understand the expected uname arguments and issue appropriate error messages if the arguments were wrong. It could read the data to display from a little config file rather than having it hard coded. Even an elaborate replacement uname command is still going to be very trivial and could be written by any competent C programmer. All of this seems very obvious and I wonder why it is even slightly interesting.

This thread is clearly about the uname command and not the uname system call. Originally, this "system call" simply had the output string hard coded. These days, it tends to be a real system call and read the data from the kernel. Most OS's still have some way to write data into the kernel. And this could be used to overwrite the data in the kernel. With some OS's even a shell script running adb could do it. Any solution along these lines is going to be very OS specific. And, at least on Solaris, the SYSV3 environment variable could then be used to ignore the incorrect data in the kernel and output the correct values anyway. So replacing the uname command is the only way to complete success.
 

9 More Discussions You Might Find Interesting

1. AIX

uname -S

hi , i have made a mistake :( on the production enviourment by change tha host name . after that i returned back the old name. but i think this will not afeect the system until reboot the machine. laso i tried to telnet the syetem by the host name not by the IP address and it works fine. ... (2 Replies)
Discussion started by: habuzahra
2 Replies

2. Linux

Uname

what is the difference between uname -m and uname -i what it actually means (2 Replies)
Discussion started by: Dileepsp
2 Replies

3. AIX

uname -S newhostname

hi freinds recently i have change hostname node as using uname -s ******* but next time i saw the name using uname -n the name did t changed is that i have to reboot the system (4 Replies)
Discussion started by: senmak
4 Replies

4. Solaris

uname help

hi all, Operating System Name : Unix Sun Solaris Operating system release level : 5.10 Operating system version : Generic_137111-06 i know the release level that is kernel version Generic_137111-06 what is number... (6 Replies)
Discussion started by: coxmanchester
6 Replies

5. Fedora

uname too vague?

Hi all, I am ssh'ed into a cluster and want to install a package. However, I don't know which type to chose (CentOS, Fedora, OpenSuSE are some of the options). I ran called uname with various arguments but none are specific... $ uname -n resolute.research... $ uname -i x86_64 $ uname... (6 Replies)
Discussion started by: neurorad
6 Replies

6. UNIX for Dummies Questions & Answers

uname -a output

Can anyone please let me know the meaning of output of uname -a ? I am totally new to unix or linux and just thinking to start learning. When I run uname -a the output I get is - "Linux blx28ap01 2.6.18-238.12.1.el5 #1 SMP Sat May 7 20:18:50 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux" I want to... (7 Replies)
Discussion started by: csrohit
7 Replies

7. Solaris

uname -a

bssmsrv223:/ 53 ] uname -a SunOS bssmsrv223 5.10 Generic_118833-36 sun4u sparc SUNW,Sun-Fire-V245 bssmsrv223:/ 54 ] what does 118833-36 denotes in Generic_118833-36 (2 Replies)
Discussion started by: hiten.r.chauhan
2 Replies

8. Shell Programming and Scripting

Why result is wrong here ? whether break statement is wrong ?

Hi ! all I am just trying to check range in my datafile pls tell me why its resulting wrong admin@IEEE:~/Desktop$ cat test.txt 0 28.4 5 28.4 10 28.4 15 28.5 20 28.5 25 28.6 30 28.6 35 28.7 40 28.7 45 28.7 50 28.8 55 28.8 60 28.8 65 28.1... (2 Replies)
Discussion started by: Akshay Hegde
2 Replies

9. Linux

Difference between UNAME and WHO

Hi, What is the exact output tells me when i issued UNAME and WHO ? Regards, Nantha.Y (2 Replies)
Discussion started by: Nandy
2 Replies
UNAME(1)								FSF								  UNAME(1)

NAME
uname - print system information SYNOPSIS
uname [OPTION]... DESCRIPTION
Print certain system information. With no OPTION, same as -s. -a, --all print all information, in the following order: -s, --kernel-name print the kernel name -n, --nodename print the network node hostname -r, --kernel-release print the kernel release -v, --kernel-version print the kernel version -m, --machine print the machine hardware name -p, --processor print the processor type -i, --hardware-platform print the hardware platform -o, --operating-system print the operating system --help display this help and exit --version output version information and exit AUTHOR
Written by David MacKenzie. REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>. COPYRIGHT
Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. SEE ALSO
The full documentation for uname is maintained as a Texinfo manual. If the info and uname programs are properly installed at your site, the command info uname should give you access to the complete manual. uname (coreutils) 4.5.3 February 2003 UNAME(1)
All times are GMT -4. The time now is 09:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy