Sunbeams
Solaris tricks
also see Solaris 10
Handy sites
Sun Freeware
Free Software Packages for Solaris
gunzip foo-1.00-sol8-sparc-local.gz
as root
pkgadd -d foo-1.00-sol8-sparc-local
Recommend Packages
top
sudo
libgcc or gcc
libintl
libiconv
lsof
Optional Useful Packages
coreutils
libgcc or gcc
libiconv
rsync
libgcc or gcc
libintl
libiconv
popt
wget ( or curl )
libgcc or gcc
libintl
libiconv
openssl
curl
libgcc or gcc
libintl
libiconv
libidn
zlib
openssl
screen
ncurses
screen setup:cp /usr/local/doc/screen/etc/screenrc /etc/screenrc edit/usr/bin/tic /usr/local/doc/screen/terminfo/screeninfo.src
Modifying Default Path
edit /etc/default/login and /etc/default/su
to add /usr/local/bin and /usr/local/sbin to their respective paths
PATH=/usr/bin:/usr/local/bin
SUPATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
Add Users
Assumptions:
Home directories are under /export/home
Default shell is bash
Accounts are limited to 8 characters
/usr/bin/mkdir -p /export/home (if needed) /usr/sbin/groupadd -g <gid> <group> (if needed) /usr/sbin/useradd -m -k /etc/skel -s /usr/bin/bash -u <uid> -g <gid> -c "<comment>" -d /export/home/<acccount> <account> -m created directory specified by -d -k /etc/skel copies the contents of /etc/skel into directory specified by -d /usr/bin/chmod 700 /export/home/<account> /usr/bin/chown -R <account>:<group> /export/home/<account> /usr/bin/passwd <account>
passmgmt
usermod
Additional Network Interface
/etc/hostname.<interface>
/etc/inet/netmasks
/etc/inet/hosts
/etc/inet/ipnodes
These should already be configured from the first interface
/etc/defaultrouter
/etc/nsswitch.conf
/etc/resolv.conf
ifconfig <interface> plumb
ifconfig <interface> <ip_address> netmask <mask> up
Firewall
Under Solaris 10, ipfilter is the firewall
References:
http://www.homepage.montana.edu/~unixuser/031705/create_solaris_ipf.html
http://learningsolaris.com/archives/2005/05/19/ipfilter-on-solaris-10-primer
http://docs.sun.com/app/docs/doc/819-3000/eupsq?l=en&a=browse Sections 25 & 26
edit:
/etc/ipf/ipf.conf
start service:
svcadm enable ipfilter
Flush all rules, then load rules in /etc/ipf/ipf.conf into active firwall.
ipf -Fa -f /etc/ipf/ipf.conf
ipfstat -i
ipfstat -o
Monitor rules with
The following blocks nothing, but logs everything, its a good place to start testing firewall rules.
pass in log all
pass out log all
The following blocks nothing outgoing, explicitly allows loopback, allows ssh from anywhere
In this example the external interface is nge0, change as needed.
Allow all traffic on loopback
pass in quick on lo0 all
pass out quick on lo0 all
#That which is not explicitly allowed is forbidden
#block in log on nge0 all
#block out log on nge0 all
#allow everything
#pass in log quick all
#pass out log quick all
#Deny reserved addresses
#block in log quick on nge0 from 10.0.0.0/8 to any
#block in log quick on nge0 from 192.168.0.0/16 to any
#block in log quick on nge0 from 172.16.0.0/12 to any
#Allow pings
pass in quick on nge0 proto icmp from any to any icmp-type 8 keep state
pass in quick on nge0 proto icmp from any to any icmp-type 13 keep state
#Allow TCP/UDP requests to go out and keep the results flowing back in
pass out quick on nge0 proto tcp/udp from any to any keep state
#Allow pings out
pass out quick on nge0 proto icmp all keep state
#Allow ssh from all vcu
#pass in quick on nge0 proto tcp from 128.172.0.0/24 to any port = 22 keep state
#Allow ssh
pass in quick on nge0 proto tcp from any to any port = 22 keep state
#NTP signal
pass in quick on nge0 proto udp from <ntp server> to 255.255.255.255 port = 123
#DHCP requests (annoying traffic)
block in quick on nge0 proto udp from any to 255.255.255.255 port = 67
block in quick on nge0 proto udp from any to 255.255.255.255 port = 68
#Block without Logging Inbound Ports 137, 138, 139, and 631:
block in quick on nge0 proto udp from any to any port = 137
block in quick on nge0 proto tcp from any to any port = 137
block in quick on nge0 proto udp from any to any port = 138
block in quick on nge0 proto tcp from any to any port = 138
block in quick on nge0 proto udp from any to any port = 139
block in quick on nge0 proto tcp from any to any port = 139
block in quick on nge0 proto tcp/udp from any to any port = 631
#Block and Log Everything Else Inbound (comment first line below to allow ping requests):
block in log first proto icmp from any to any
block in log first proto tcp/udp from any to any
When the "log" parameter is used, ipf will send logs to syslog, but syslog.conf needs to be modified in order to know how to handle them
Create location for log file
touch /var/log/ipfilter.log
chmod 600 /var/log/ipfilter.log
Edit /etc/syslog.conf to add this line:
local0.debug /var/log/ipfilter.log
This entry must use tabs and not spaces, else you will see a "syslogd: unknown priority name" warning in /var/adm/messages.
Restart syslog with
svcadm restart system-log
Log rotation will also need to be added for this new log file. This command adds an entry to /etc/logadm.conf
logadm -w ipfilter -C 8 -o root -g sys -m 600 /var/log/ipfilter.log -a 'kill -HUP `cat /var/run/syslog.pid'
C = number of previous versions to keep
o = owner, g = group, m = permission
default rotation period is daily
Examples are in /usr/share/ipfilter/examples/
If the firewall is active, but not working ( scanning isn't blocked, nothing logged ) and the /etc/ipf/pfil.ap file exists, make sure the network interface(s) exists and is commented out, the restart networking from the console as in http://learningsolaris.com/archives/2005/05/19/ipfilter-on-solaris-10-primer
patchadd
Sol 10 patchadd - is exit code "1" the new exit code "2"?
http://forum.java.sun.com/thread.jspa?threadID=5140119&messageID=9514972
OLD Return Codes:
0 No error
1 Usage error
2 Attempt to apply a patch that's already been applied
3 Effective UID is not root
4 Attempt to save original files failed
5 pkgadd failed
6 Patch is obsoleted
7 Invalid package directory
8 Attempting to patch a package that is not installed
9 Cannot access /usr/sbin/pkgadd (client problem)
10 Package validation errors
11 Error adding patch to root template
12 Patch script terminated due to signal
13 Symbolic link included in patch
14 NOT USED
15 The prepatch script had a return code other than 0.
16 The postpatch script had a return code other than 0.
17 Mismatch of the -d option between a previous patch
install and the current one.
18 Not enough space in the file systems that are targets
of the patch.
19 $SOFTINFO/INST_RELEASE file not found
20 A direct instance patch was required but not found
21 The required patches have not been installed on the
manager
22 A progressive instance patch was required but not found
23 A restricted patch is already applied to the package
24 An incompatible patch is applied
25 A required patch is not applied
26 The user specified backout data can't be found
27 The relative directory supplied can't be found
28 A pkginfo file is corrupt or missing
29 Bad patch ID format
30 Dryrun failure(s)
31 Path given for -C option is invalid
32 Must be running Solaris 2.6 or greater
33 Bad formatted patch file or patch file not found
34 Incorrect patch spool directory
35 Later revision already installed
36 Cannot create safe temporary directory
37 Illegal backout directory specified
38 A prepatch, prePatch or a postpatch script could not be
executed
NFS
edit /etc/dfs/dfstab
share -F nfs -o ro,root=client.vcu.edu /data
share -F nfs -o rw=client1.vcu.edu:client2.vcu.edu /data
svcadm enable network/nfs/server
Advanced Lights-Out Management (ALOM)
ssh root@<ip address> (make sure its plugged in)start /SP/consoleSerial console started. To stop, type ESC (
Reference: http://docs.sun.com/source/819-4358-12/chap2-sw.html#0_35221
/export/home and autofs
http://www.c0t0d0s0.org/archives/4120-Less-known-Solaris-Features-exporthome-home-autofs.html
OpenSolaris NTFS support
Attach /var/adm/messges
Jun 6 11:44:52 thumper usba: ID 912658 kern.info USB 2.0 device (usb67b,2507) operating at hi speed (USB 2.x) on USB 2.0 external hub: storage@2, scsa2usb3 at bus address 3
Jun 6 11:44:52 thumper usba: ID 349649 kern.info Prolific Technology Inc. Mass Storage Device
Jun 6 11:44:52 thumper genunix: ID 936769 kern.info scsa2usb3 is /pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2
Jun 6 11:44:52 thumper genunix: ID 408114 kern.info /pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2 (scsa2usb3) online
Jun 6 11:44:52 thumper scsi: ID 193665 kern.info sd51 at scsa2usb3: target 0 lun 0
Jun 6 11:44:52 thumper genunix: ID 936769 kern.info sd51 is /pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0
Jun 6 11:44:52 thumper genunix: ID 408114 kern.info /pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0 (sd51) online
cfgadm -lAp_Id Type Receptacle Occupant Condition
sata0/0::dsk/c0t0d0 disk connected configured ok
sata0/1::dsk/c0t1d0 disk connected configured ok
sata0/2::dsk/c0t2d0 disk connected configured ok
sata0/3::dsk/c0t3d0 disk connected configured ok
sata0/4::dsk/c0t4d0 disk connected configured ok
sata0/5::dsk/c0t5d0 disk connected configured ok
sata0/6::dsk/c0t6d0 disk connected configured ok
sata0/7::dsk/c0t7d0 disk connected configured ok
sata1/0::dsk/c1t0d0 disk connected configured ok
sata1/1::dsk/c1t1d0 disk connected configured ok
sata1/2::dsk/c1t2d0 disk connected configured ok
sata1/3::dsk/c1t3d0 disk connected configured ok
sata1/4::dsk/c1t4d0 disk connected configured ok
sata1/5::dsk/c1t5d0 disk connected configured ok
sata1/6::dsk/c1t6d0 disk connected configured ok
sata1/7::dsk/c1t7d0 disk connected configured ok
sata2/0::dsk/c4t0d0 disk connected configured ok
sata2/1::dsk/c4t1d0 disk connected configured ok
sata2/2::dsk/c4t2d0 disk connected configured ok
sata2/3::dsk/c4t3d0 disk connected configured ok
sata2/4::dsk/c4t4d0 disk connected configured ok
sata2/5::dsk/c4t5d0 disk connected configured ok
sata2/6::dsk/c4t6d0 disk connected configured ok
sata2/7::dsk/c4t7d0 disk connected configured ok
sata3/0::dsk/c5t0d0 disk connected configured ok
sata3/1::dsk/c5t1d0 disk connected configured ok
sata3/2::dsk/c5t2d0 disk connected configured ok
sata3/3::dsk/c5t3d0 disk connected configured ok
sata3/4::dsk/c5t4d0 disk connected configured ok
sata3/5::dsk/c5t5d0 disk connected configured ok
sata3/6::dsk/c5t6d0 disk connected configured ok
sata3/7::dsk/c5t7d0 disk connected configured ok
sata4/0::dsk/c6t0d0 disk connected configured ok
sata4/1::dsk/c6t1d0 disk connected configured ok
sata4/2::dsk/c6t2d0 disk connected configured ok
sata4/3::dsk/c6t3d0 disk connected configured ok
sata4/4::dsk/c6t4d0 disk connected configured ok
sata4/5::dsk/c6t5d0 disk connected configured ok
sata4/6::dsk/c6t6d0 disk connected configured ok
sata4/7::dsk/c6t7d0 disk connected configured ok
sata5/0::dsk/c7t0d0 disk connected configured ok
sata5/1::dsk/c7t1d0 disk connected configured ok
sata5/2::dsk/c7t2d0 disk connected configured ok
sata5/3::dsk/c7t3d0 disk connected configured ok
sata5/4::dsk/c7t4d0 disk connected configured ok
sata5/5::dsk/c7t5d0 disk connected configured ok
sata5/6::dsk/c7t6d0 disk connected configured ok
sata5/7::dsk/c7t7d0 disk connected configured ok
usb0/1 usb-device connected configured ok
usb0/2 unknown empty unconfigured ok
usb0/3 unknown empty unconfigured ok
usb1/1 unknown empty unconfigured ok
usb1/2 unknown empty unconfigured ok
usb1/3 unknown empty unconfigured ok
usb2/1 usb-storage connected configured ok
usb2/2 unknown empty unconfigured ok
usb2/3 unknown empty unconfigured ok
usb3/1 usb-storage connected configured ok
usb3/2 unknown empty unconfigured ok
usb4/1 unknown empty unconfigured ok
usb4/2 unknown empty unconfigured ok
usb4/3 unknown empty unconfigured ok
usb4/4 unknown empty unconfigured ok
usb4/5 usb-hub connected configured ok
usb4/5.1 unknown empty unconfigured ok
usb4/5.2 usb-storage connected configured ok
usb4/5.3 unknown empty unconfigured ok
usb4/5.4 unknown empty unconfigured ok
ls -larth /dev/dsk
<snip>
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s0 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:a
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s1 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:b
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s2 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:c
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s3 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:d
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s4 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:e
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s5 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:f
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s6 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:g
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s7 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:h
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s8 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:i
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s9 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:j
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s10 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:k
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s11 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:l
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s12 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:m
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s13 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:n
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s14 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:o
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0s15 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0p0 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:q
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0p1 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:r
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0p2 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:s
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0p3 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:t
lrwxrwxrwx 1 root root 78 Jun 6 11:44 c8t0d0p4 -> ../../devices/pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@2/disk@0,0:u
/usr/bin/prtpart
Fdisk information for device /dev/rdsk/c7t7d0p0
Block Size : 512 bytes
Controller : pci11ab,6081.9
Disk : sd
Capacity : 465 GB
start block # nblocks startCylSecHd endCylSecHd OSType
1: 0000000001 0976773166 ff/ff/ff ff/ff/ff EFI Header Indicator
/usr/bin/prtpart /dev/rdsk/c7t7d0p0 -ldevs
Fdisk information for device /dev/rdsk/c7t7d0p0
NOTE **
/dev/dsk/c7t7d0p0 - Physical device referring to entire physical disk
/dev/dsk/c7t7d0p1 - p4 - Physical devices referring to the 4 primary partitions
/dev/dsk/c7t7d0p5 ... - Virtual devices referring to logical partitions
Virtual device names can be used to access EXT2 and NTFS on logical partitions
/dev/dsk/c7t7d0p1 EFI Header Indicator
mount -F ntfs /dev/dsk/c7t7d0p1 /mnt/ntfs
First see what removable media is out there:
rmformat -l
h4. h4. h4. h4. h4. h1. Looking for devices...
1. Volmgt Node: /vol/dev/aliases/cdrom0
Logical Node: /dev/rdsk/c2t0d0s2
Physical Node: /pci@0,0/pci1022,7460@6/pci1033,35@4/storage@1/disk@0,0
Connected Device: AMI Virtual CDROM 1.00
Device Type: CD Reader
2. Volmgt Node: /vol/dev/aliases/rmdisk0
Logical Node: /dev/rdsk/c3t0d0p0
Physical Node: /pci@0,0/pci1022,7460@6/pci1033,35@4,1/storage@1/disk@0,0
Connected Device: AMI Virtual Floppy 1.00
Device Type: <Unknown>
3. Volmgt Node: /vol/dev/aliases/rmdisk1
Logical Node: /dev/rdsk/c9t0d0p0
Physical Node: /pci@0,0/pci1022,7460@6/pci1033,e0@4,2/hub@5/storage@1/disk@0,0
Connected Device: WDC WD25 00JB-00GVC0 08.0
Device Type: Removable
h4. h4. h4. h4. h3. =
Now we can see the USB drive is at "/dev/rdsk/c9t0d0p0". The problem is we
can't mount it because the Volume Manager (vold) has it 'opened'. To stop VOLD
issue the command:
svcadm disable volfs
Now mount the USB drive with the command:
mount -F ntfs /dev/dsk/c9t0d0p1 <some directory>
mount -F ntfs /dev/dsk/c9t0d0p1 /usb> is what I used......
Now you can restart the Volume Manager with the command:
svcadm enable volfs
df -h
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d10 11G 6.3G 4.2G 61% /
/devices 0K 0K 0K 0% /devices
ctfs 0K 0K 0K 0% /system/contract
proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
swap 15G 732K 15G 1% /etc/svc/volatile
objfs 0K 0K 0K 0% /system/object
/usr/lib/libc/libc_hwcap2.so.1
11G 6.3G 4.2G 61% /lib/libc.so.1
fd 0K 0K 0K 0% /dev/fd
/dev/md/dsk/d30 5.8G 4.1G 1.6G 73% /var
swap 15G 24K 15G 1% /var/run
zpool1 17T 16G 17T 1% /data
127.0.0.1:/ 1.8T 1.8T 0K 100% /mnt/ntfs
/usr/bin/xlsmountsPHYSICAL DEVICE LOGICAL DEVICE FS PID ADDR Mounted on
/dev/dsk/c8t0d0p1 /dev/dsk/c8t0d0p1 ntfs 1283 127.0.0.1:/ /mnt/ntfs
/usr/bin/xumount /mnt/ntfs
The NFS server many not stop cleanly.
References: