From - Mon Nov 25 18:54:50 1996 Path: news.unizar.es!news.rediris.es!news.belnet.be!swsbe6.switch.ch!swidir.switch.ch!in2p3.fr!univ-lyon1.fr!howland.erols.net!cam-news-hub1.bbnplanet.com!news.bbnplanet.com!su-news-hub1.bbnplanet.com!news.pbi.net!samba.rahul.net!rahul.net!a2i!squirrel.com!ratatosk!mch From: mch@squirrel.com (Mark Henderson) Newsgroups: comp.sys.sgi.admin Subject: changing system id as reported by IRIX Date: 25 Nov 1996 07:30:55 GMT Organization: squirrel.com - http://www.squirrel.com/squirrel/ Lines: 130 Message-ID: <57bhvf$4v9@samba.rahul.net> NNTP-Posting-Host: squirrel.com Let me start of by saying that I don't know a lot about IRIX, which is why I'm posting here. I publish a free (public-domain) package called change-sun-hostid which allows one to change the hostid/serial number as reported by sysinfo under Sun OS 4.1.x and Solaris 2.x. The intention is that this be used in a disaster recovery situation where one can't get new licence keys quickly enough in the event of system failure. Several people have asked me for something like this for IRIX. I haven't been able to help them - but I finally got temporary access to an Indigo running IRIX 5.3 and took a couple of hours to hack something together that seems to modify the return values from sysid/sysinfo(HW_SERIAL,...) on the Indigo. I have my doubts as to whether it will work on all SGI architectures or on other versions of IRIX. For all I know it might only work with the particular kernel that happens to be installed on this machine. Some C code follows. Be careful with it - if it malfunctions it may well crash your machine. What I want is... 1. some idea of what OS versions and architectures this works on (i.e. some testers) 2. modifications to this code for other versions of IRIX and architectures or temporary access to some other systems so that I can figure it out myself (yes, this does need root access - this should not be access to machines with anything sensitive on them, or that need to stay up, and not in violation of any institutional/corporate policies) Hopefully we can put together some sort of tool which will be of general use to the SGI community. I'm willing to give credit or not as requested. The only restriction is that you should be willing to donate any code or documentation to the public domain so I can distribute it on the same basis as change-sun-hostid (free/public-domain). here's a sample session... rodent 42# cc -o change-sid change-sid.c -lmld rodent 43# sysinfo System ID: de ad 12 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 rodent 44# ./change-sid hexadecimal system id seems to be dead1234 rodent 45# ./change-sid 12345678 rodent 46# ./change-sid hexadecimal system id seems to be 12345678 rodent 47# sysinfo System ID: 12 34 56 78 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -- change-sid.c -- /* * change system id on IRIX 5.3 - only minimally tested on one machine * consider this pre-pre-alpha - USE AT YOUR OWN RISK * compile by -- cc -o change-sid change-sid.c -lmld * placed in the public domain by the author - Nov 1996 * Mark Henderson */ #include #include #include #include #include #include struct nlist nl[2]; main(argc,argv) int argc; char *argv[]; { int kmem; int just_read = 0; unsigned int new_id, cur_id; off_t where; just_read = (argc <= 1); if (argc > 1) new_id = strtoul(argv[1], NULL, 16); if ((kmem = open("/dev/kmem", O_RDWR)) < 0) { fprintf(stderr, "cannot open /dev/kmem\n"); exit(1); } nl[0].n_name="eccf_addr"; nl[1].n_name = NULL; if (nlist("/unix", nl) < 0) { fprintf(stderr, "cannot read namelist out of /dev/ksyms\n"); exit(1); } if ((where = nl[0].n_value) == 0) { fprintf(stderr, "unknown kernel variable eccf_addr\n"); exit(1); } if (lseek(kmem, where + 4, SEEK_SET) == (-1)) { fprintf(stderr, "lseek on /dev/kmem failed\n"); exit(1); } if (!just_read) { if (write (kmem, &new_id, 4) < 4) { fprintf(stderr, "write to /dev/kmem failed\n"); exit(1); } } else { if (read(kmem, &cur_id, 4) < 4) { fprintf(stderr, "read failed\n"); exit(1); } printf("hexadecimal system id seems to be %08x\n", cur_id); } close(kmem); exit(0); } -- Mark Henderson -- mch@squirrel.com, henderso@netcom.com, markh@wimsey.bc.ca ViaCrypt PGP Key Fingerprint: 21 F6 AF 2B 6A 8A 0B E1 A1 2A 2A 06 4A D5 92 46 unstrip for Solaris, Wimsey crypto archive, TECO, computer security links, change-sun-hostid, Sun NVRAM/hostid FAQ - http://www.squirrel.com/squirrel/