HomeProductsCookbookPhotosProgrammingAdminKBBrewLinksSearch

Sys Admin Junk

Whenever I come across something that saves my life, I put it here. If you'd like to add something relevant to Solaris sysadmin, send it to me

Solaris stuff

  1. Allowing a normal user to halt the system
  2. Setting up simple DNS services
  3. Accessing a remote printer
  4. Remote diagnostic commands
  5. Changing a system's timezone
  6. Installing the HighWater PEL driver
  7. Removing the HighWater PEL driver
  8. Deleting all corefiles on a system
  9. Finding big files created within the last few days
  10. Skey-enabling a server

Allowing a normal user to halt the system
The following lets a user halt the system by typing "su halt" 

  1. Become superuser
  2. run admintool
  3. create a new user
  4. Username: halt
  5. User ID: 0
  6. Group ID: 1
  7. Shell: Other: /usr/sbin/halt
  8. Passwd: Normal
  9. Don't create a home directory

Setting up simple DNS services

  1. Edit /etc/hosts and add an entry for your internet gateway 
  2. Edit /etc/nsswitch.conf and change the hosts line to read: hosts: files dns 
  3. Create /etc/resolv.conf 
  4. Add your domain name: domain la.cortron.com 
  5. Add your nameserver's address: nameserver 205.147.0.100 
  6. Save file 
  7. Create /etc/defaultrouter and add the hosts entry for your gateway
  8. Create /etc/defaultdomain and add your domain name 

Accessing a remote printer
Forget trying to set up access to a print server under Solaris 2.X admintool. It doesn't work. In the following example, the print server is server, the print client is client, and the printer name is laser

  1. lpsystem -t s5 server 
  2. lpadmin -p laser -s server 
  3. lpadmin -p laser -T unknown 
  4. lpadmin -p laser -I any 
  5. acceptlaser 
  6. enable laser 
  7. lpadmin -p laser -D "desciption of remote printer"
  8. lpadmin -d laser (only if you want this to be the default printer) 
  9. lpstat -t (shouldn't display any error messages) 

Remote diagnostic commands

  1. rup [ip addr]: how long a system has been running 
  2. netstat -rn: shows system routing table 
  3. ifconfig -a: shows configured network interfaces 
  4. tail -f [filename]: monitor a logfile 
  5. sysdef -h: print system's hostid 
  6. uname -n: print system's hostname 
  7. prtconf: print hardware & driver info 

Changing a system's timezone
You change a system's timezone by editing the TIMEZONE file. A listing of timezone files can be found in /usr/share/lib/zoneinfo 

  1. su 
  2. edit file: /etc/TIMEZONE 
  3. change line: TZ=US/Pacific;export TZ 
  4. save changes & exit 
  5. reboot system 

Changing a system's timezone
You change a system's timezone by editing the TIMEZONE file. A listing of timezone files can be found in /usr/share/lib/zoneinfo 

  1. su 
  2. edit file: /etc/TIMEZONE 
  3. change line: TZ=US/Pacific;export TZ 
  4. save changes & exit 
  5. reboot system 

Installing the HighWater PEL driver
This example assumes that the filename of the PEL driver is "pel". Note that ln command below uses two different kinds of single quote (the first and last ones are backward quotes). 

  1. power down system 
  2. install PEL board 
  3. boot 
  4. login as superuser 
  5. cp <path to pel driver> /usr/kernel/drv 
  6. add_drv -i "SUNW,pelboxif" pel 
  7. check if it loaded by: modinfo | grep pel 
  8. ln -s `find /devices -name '*SUNW,pelboxif*' -print` /dev/pel0
  9. chmod 777 /dev/pel0 
  10. halt 
  11. boot -r 

Removing the HighWater PEL driver

  1. become superuser 
  2. rem_drv pel 
  3. halt 
  4. turn power off 
  5. remove PEL board 
  6. boot -r 

Deleting all corefiles on a system

  1. become superuser
  2. find / -name core -exec rm -f {} \; -print

Finding big files created within the last few days

A few notes: the -mount parameter restricts the search to a single filesystem. If you want to search all mounts, remove -mount. Also, there needs to be at least 3 spaces before the +6 

  1. find <pathname> -mount -mtime -<days> -ls | sort -rnt +6

Here's a script that does the job


Skey enabling a server

Before you start this procudure, you should ftp orbis.net/pub/cortron/utils/unix/skey-server.tar.Z and install it on the server using tar xvf skey-server.tar.Z

Replacing the login binary

  1. su root
  2. mv /usr/bin/login /usr/bin/login.original
  3. install -o bin -g bin -m 14755 /usr/local/bin/login /usr/bin/login

Replacing the FTP daemon

  1. su root
  2. run /usr/local/bin/ftpcheck to make sure binaries are in proper location (don't worry about XFERLOG or FTPHOSTS)
  3. chmod 644 /etc/inet/inetd.conf
  4. vi /etc/inet/inetd.conf
  5. change line for in.ftp to ftp stream tcp nowait root /usr/local/etc/ftpd ftpd
  6. save file
  7. chmod 444 /etc/inet/inetd.conf
  8. find process number of in.inetd (ps -e | grep inetd)
  9. kill -HUP <in.inetd's process number>

Initializing Skey logins

  1. su root
  2. vi /etc/skey.access
  3. add line: permit port console
  4. add line: deny
  5. save file
  6. chmod 644 /etc/skey.access
  7. create an empty file called /etc/skeykeys
  8. chmod 666 /etc/skeykeys
  9. /usr/local/bin/keyinit <login name>
  10. type secret password
  11. test your login from a remote machine


 

Please send any comments or suggestions to grimmd@geocities.com