Wrong 'uname' )


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Wrong 'uname' )
# 8  
Old 01-03-2007
DeepakS
i think it's not the right unix way =) 'cuz you must recompile the kernel (it's not a problem, but for this case - i think -isn't the right way Smilie
mybe some other advices?
# 9  
Old 01-03-2007
uname command with -S (Capital S) can be used to change the System name, but not other elements.

uname -S <new host name>

You can play arround with SYSV3 environment variable to achieve what you are asking for.

The individual elements that uname displays can be modified by setting SYSV3 in the following format:

os,sysname,node,rel,ver,mach

Correct me if i am wrong Smilie

Last edited by iamcollins; 01-03-2007 at 04:15 PM..
# 10  
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.
# 11  
Old 01-03-2007
Quote:
I have only seen this feature on Solaris
it's bad Smilie, 'cause I have Linux
Quote:
And you can create a slightly more complex replacement command as well
you mean - to create uname fake?
yeah, a root can - but i thought that it can do in normal way Smilie
Quote:
be very trivial and could be written by any competent C programmer
unfortunately, i'm not a c programmer.... ( ...yet )
Quote:
These days, it tends to be a real system call and read the data from the kernel
eemm...i didn't understand this string Smilie
# 12  
Old 01-03-2007
If you are asking about a standard documented procedure intended to provide to a system administrator with the root passwd the ability to cause the standard uname command to misrepresent which kernel in use, I am afraid that I have bad news. The developers of Linux seemed to have overlooked the need for such a command! Sorry. Switch to Solaris... its uname command supports that SYSV3 environment variable. And I doubt that any other version of Unix has it. The Solaris kernel calls itself SunOS by default. Most other vendors settled on a single name for their OS. This may explain why Sun felt the need for feature like this.

A replacement uname command could be written in bash or perl or any other language. If you're not a programmer, you may not be able to imagine what it means for a program to grab info from the kernel. If so, don't worry about it until after you're a programmer. Interacting with the kernel is an advanced programming concept.
# 13  
Old 01-04-2007
uname setting

hi !

uname is the binary file , we cannot set , but we can do one thing is that we can write the script which works based on the uname

u can get what are the contents of uname using the
#strings /bin/uname
# 14  
Old 01-04-2007
Quote:
The developers of Linux seemed to have overlooked the need for such a command!
Smilie
Quote:
Switch to Solaris...
I havent use (even haven't seen) it ever Smilie
Quote:
And I doubt that any other version of Unix has it.
yeah, i'm sure in this too )
Quote:
The Solaris kernel calls itself SunOS by default
I thought that SunOS is an operating system Smilie Smilie
Quote:
If you're not a programmer, you may not be able to imagine what it means for a program to grab info from the kernel
u r right, unfortunately Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. Linux

Uname

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

9. 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
Login or Register to Ask a Question