Skip to content

Category Archives: Operating Systems

Configuring a Printer on Solaris

01-Mar-10

Adapted from the lpadmin man page, for an HP JetDirect printer:
> pfexec lpadmin -p lp01 -v /dev/null -m netstandard -o dest=lp01.example.com:9100 -o protocol=tcp -T PS -I postscript
> pfexec lpset -a banner=never lp01
> pfexec lpadmin -d lp01
> pfexec enable lp01
> pfexec accept lp01

Services I like to disable on Solaris

26-Feb-10

YMMV; adjust as you see fit:
svcadm disable svc:/network/nfs/mapid:default
svcadm disable svc:/network/nfs/cbd:default
svcadm disable svc:/network/nfs/status:default
svcadm disable svc:/network/nfs/nlockmgr:default
svcadm disable svc:/network/rpc/rstat:default
svcadm disable svc:/application/x11/xfs:default
svcadm disable svc:/network/finger:default
svcadm disable svc:/network/ftp:default
svcadm disable svc:/network/login:rlogin
svcadm disable svc:/network/nfs/rquota:default
svcadm disable svc:/network/nfs/client:default
svcadm disable svc:/network/rpc/rusers:default
svcadm disable svc:/network/rpc/cde-ttdbserver:tcp
svcadm disable svc:/network/shell:default
svcadm disable svc:/network/telnet:default
svcadm disable svc:/network/cde-spc:default
svcadm disable svc:/application/management/seaport:default
svcadm disable svc:/application/management/snmpdx:default
svcadm disable svc:/application/management/dmi:default
svcadm disable svc:/system/webconsole:console
svcadm disable svc:/application/print/ipp-listener:default

pfexec as sudo replacement

26-Feb-10

To use pfexec similarly to sudo, use “usermod” to give the account the “Primary Administrator” profile:
# usermod -P’Primary Administrator’ aleonard
“aleonard” will now be able to preface commands with “pfexec” to run them as root, similar to sudo when configured not to prompt for a password.
References: Less known Solaris features: pfexec

Using Sendmail Maps on Solaris

26-Feb-10

Configure ‘/usr/lib/mail/cf/sendmail.mc’ to meet your needs; for example, to use the access_db and mailertable features:
divert(0)dnl
VERSIONID(`@(#)sendmail.mc 1.11 (Sun) 06/21/04′)
OSTYPE(`solaris8′)dnl
DOMAIN(`generic’)dnl
FEATURE(access_db, `hash -o -T /etc/mail/access’)
FEATURE(mailertable, `hash -o /etc/mail/mailertable’)
MAILER(`local’)dnl
MAILER(`smtp’)dnl

The new ’sendmail.cf’ can be built in ‘/usr/lib/mail/cf/sendmail.mc’ by running ‘make’ as root. Copy the new ’sendmail.cf’ file to ‘/etc/mail’ and restart sendmail by running:
# svcadm [...]

Scan for Hot-Added Devices in Solaris 10

22-Feb-10

Use “devfsadm”; from the man page:
devfsadm(1M) maintains the /dev namespace. It replaces the previous suite of devfs administration tools including drvconfig(1M), disks(1M), tapes(1M), ports(1M), audlinks(1M), and devlinks(1M).
References: Adding a Hard Drive to Solaris 10

Flushing nscd’s cache

22-Dec-09

By default, in RHEL, nscd is configured to have a persistent cache – one that is “stored on the disk and therefore survive[s] a nscd restart or e.g. machine reboot” according to the nscd.conf man page.
To flush the cache, you must run nscd with the “-i” flag instead of simply restarting it:

sudo [...]

Changing a Solaris Machine’s IP Address

11-Dec-09

Edit the following files as appropriate:

/etc/hosts
/etc/nodename
/etc/hostname.<interface>
/etc/defaultrouter

Reboot to apply the changes, or run:
# svcadm restart network/physical

One-liner to clean up ZFS Snapshots

01-Oct-09

Here for my reference; adapt for your convenience:
# for snapshot in `zfs list -H -t snapshot -r /opt/datastore | egrep ‘2009\-0[1-8]‘ | awk ‘{print $1}’`; do zfs destroy $snapshot; done

Creating an XFS Partition

23-Jun-09

Steps for creating an XFS partition on /dev/sdc which encompasses the entire disk. (LVM is not used in this example. Post written using Scientific Linux 5.3, but should be relevant to any RHEL clone with XFS support.)
Partition the disk using fdisk; we want the standard Linux partition id of “83″, so no need [...]

Extracting an RPM without installing it

01-Apr-09

If you want to inspect files in an RPM without installing it, use rpm2cpio piped to cpio:
rpm2cpio file.rpm | cpio -id
Note that this will create a (local) directory tree under which the extracted files will be placed. In other words, expect the files to be extracted under a newly created “usr” directory or similar.