Skip to content

Category Archives: Solaris

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

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

Using crle on Solaris

09-Jan-09

The crle command on Solaris is used to configure the runtime linking environment (get it?). If you are seeing errors similar to the following, you may need to look at and adjust your linking environment with crle:
ld.so.1: conftest: fatal: libreadline.so.5: open failed: No such file or directory
Using crle is straightforward; to view the current [...]

Managing Solaris Services with SMF

09-Jan-09

Check the status of a service:
> svcs ntp
STATE STIME FMRI
disabled Feb_27 svc:/network/ntp:default
View a service’s dependencies:
> svcs -d ntp
STATE STIME [...]

Add a loopback filesystem to a non-global Solaris zone

09-Jan-09

Use zonecfg to configure the lofs mount; this will work nicely for CDs in addition to ordinary filesystems:
# zonecfg -z zone1
zonecfg:zone1> add fs
zonecfg:zone1:fs> set dir=/depot
zonecfg:zone1:fs> set special=/depot
zonecfg:zone1:fs> set type=lofs
zonecfg:zone1:fs> add options [nodevices]
zonecfg:zone1:fs> end
zonecfg:zone1> commit
zonecfg:zone1> exit
special is the directory from the global zone to mount; dir is the mount [...]