= Cheatsheet Solaris =
**Summary**: A cheatsheet to collect various information and commands for solaris. \\
**Date**: 3 January 2025 \\
{{tag>cheatsheet solaris}}
== Shutdown & reboot ==
You have more than one command option that you can use. The best command is this, executed as root:
shutdown -y -i5 -g0
This will immediately shut the system down. You can also use the older command that still works:
sync;sync;init 5
You can even use:
poweroff
Reboot
If you are trying to reboot the system as opposed to turning it off, you could use:
shutdown -y -i6 -g0
Or:
sync;sync;init 6
Or even:
reboot
== Runlevel ==
Find current runlevel:
sjoerd@solaris:/etc$ who -r
. run-level 3 Mar 8 10:59 3 0 S
== Starting Microsoft SCOM Agent ==
root@solaris:/opt/microsoft/scx/bin/tools# ll
total 1078
-r-xr-xr-x 1 root bin 1.9K Aug 20 2009 scx-cimd
-rwxr-xr-x 1 root root 164 Aug 20 2009 scxadmin
-rwxr--r-- 1 root root 180K Aug 20 2009 scxcimcli
-rwxr--r-- 1 root root 124K Aug 20 2009 scxcimconfig
-rwxr--r-- 1 root root 46K Aug 20 2009 scxcimmof
-rwxr--r-- 1 root root 46K Aug 20 2009 scxcimmofl
-rwxr-xr-x 1 root root 168 Aug 20 2009 scxsslconfig
-rwxr--r-- 1 root root 103K Aug 20 2009 scxwbemexec
-rw-r--r-- 1 root root 232 Aug 20 2009 setup.sh
root@solaris:/opt/microsoft/scx/bin/tools# ./scx-cimd start
Starting Cim server daemon
ps -ef now shows:
root 939 1 0 11:49:48 ? 0:00 /opt/microsoft/scx/bin/scxcimserver
== Services mgmt ==
root@solaris:~# svcadm clean scx-cimd
Usage: svcadm [-v] [cmd [args ... ]]
svcadm enable [-rst] ... - enable and online service(s)
svcadm disable [-st] ... - disable and offline service(s)
svcadm restart ... - restart specified service(s)
svcadm refresh ... - re-read service configuration
svcadm mark [-It] ... - set maintenance state
svcadm clear ... - clear maintenance state
svcadm milestone [-d] - advance to a service milestone
Services can be specified using an FMRI, abbreviation, or fnmatch(5)
pattern, as shown in these examples for svc:/network/smtp:sendmail
svcadm svc:/network/smtp:sendmail
svcadm network/smtp:sendmail
svcadm network/*mail
svcadm network/smtp
svcadm smtp:sendmail
svcadm smtp
svcadm sendmail
[1]+ Done /opt/MegaRaidStorageManager/MegaPopup/popup
root@solaris:~# svcadm clear scx-cimd scx-cimd
root@solaris:~# svcadm enable scx-cimd scx-cimd
root@solaris:~# cd /lib/
Display all 241 possibilities? (y or n)
root@solaris:~# cd /lib/svc/method/
root@solaris:/lib/svc/method# ./scx-cimd status
Checking for service Cim server daemon
Cim server daemon (804) is running
root@solaris:/lib/svc/method# svcs scx-cimd
STATE STIME FMRI
online 11:36:08 svc:/application/management/scx-cimd:default
root@solaris:/lib/svc/method#
= Hardware Diagnostic =
root@solarissparc:/opt/SUNWsan/bin# prtdiag
System Configuration: Sun Microsystems sun4us Fujitsu Siemens PRIMEPOWER650 1-slot 8x SPARC64 V
System clock frequency: 270 MHz
Memory size: 24576 Megabytes
========================= CPUs =========================
Run Ecache CPU CPU
Brd CPU Module MHz MB Impl. Mask
--- --- ------- ----- ------ ------ ----
0 0 0 2024 3.0 5 5.1
0 1 1 2024 3.0 5 5.0
0 2 2 2024 3.0 5 5.1
0 3 3 2024 3.0 5 5.1
0 4 4 2024 3.0 5 5.1
0 5 5 2024 3.0 5 5.2
0 6 6 2024 3.0 5 5.1
0 7 7 2024 3.0 5 5.2
========================= IO Cards =========================
Bus Freq
Brd Type MHz Slot Name Model
--- ---- ---- ---------- ---------------------------- --------------------
0 PCI 33 1 network-SUNW,hme
0 PCI 33 1 scsi-glm/disk (block) Symbios,53C875
0 PCI 33 1 scsi-glm/disk (block) Symbios,53C875
0 PCI 33 1 lpfc-pci10df,fa00/fp (fp) LP10000
0 PCI 66 1 lpfc-pci10df,fa00/fp (fp) LP10000
0 PCI 33 1 FJSV,pgtb-fjgi Broadcom,BCM5703C
0 PCI 66 1 FJSV,pgtb-fjgi Broadcom,BCM5703C
0 PCI 33 2 FJSV,pgtb-fjgi Broadcom,BCM5703C
No failures found in System
===========================
root@solarisintel:~# prtdiag
System Configuration: IBM IBM 3850 M2 / x3950 M2 -[72336LG]-
BIOS Configuration: IBM -[A3E170AUS-1.16]- 12/21/2010
BMC Configuration: IPMI 2.0 (KCS: Keyboard Controller Style)
==== Processor Sockets ====================================
Version Location Tag
-------------------------------- --------------------------
Intel Xeon MP Node 1 CPU 3
Intel Xeon MP Node 1 CPU 1
Intel Xeon MP Node 1 CPU 2
Intel Xeon MP Node 1 CPU 4
==== Memory Device Sockets ================================
Type Status Set Device Locator Bank Locator
------- ------ --- ------------------- --------------------
DDR2 in use 1 DIMM1 Node1/Bank1/MemCard1
DDR2 in use 1 DIMM5 Node1/Bank1/MemCard1
DDR2 in use 2 DIMM2 Node1/Bank2/MemCard1
DDR2 in use 2 DIMM6 Node1/Bank2/MemCard1
DDR2 in use 3 DIMM3 Node1/Bank3/MemCard1
DDR2 in use 3 DIMM7 Node1/Bank3/MemCard1
DDR2 in use 4 DIMM4 Node1/Bank4/MemCard1
DDR2 in use 4 DIMM8 Node1/Bank4/MemCard1
DDR2 in use 5 DIMM1 Node1/Bank5/MemCard2
DDR2 in use 5 DIMM5 Node1/Bank5/MemCard2
DDR2 in use 6 DIMM2 Node1/Bank6/MemCard2
DDR2 in use 6 DIMM6 Node1/Bank6/MemCard2
DDR2 in use 7 DIMM3 Node1/Bank7/MemCard2
DDR2 in use 7 DIMM7 Node1/Bank7/MemCard2
DDR2 empty 8 DIMM4 Node1/Bank8/MemCard2
DDR2 empty 8 DIMM8 Node1/Bank8/MemCard2
DDR2 in use 9 DIMM1 Node1/Bank9/MemCard3
DDR2 in use 9 DIMM5 Node1/Bank9/MemCard3
DDR2 in use 10 DIMM2 Node1/Bank10/MemCard3
DDR2 in use 10 DIMM6 Node1/Bank10/MemCard3
DDR2 in use 11 DIMM3 Node1/Bank11/MemCard3
DDR2 in use 11 DIMM7 Node1/Bank11/MemCard3
DDR2 empty 12 DIMM4 Node1/Bank12/MemCard3
DDR2 empty 12 DIMM8 Node1/Bank12/MemCard3
DDR2 in use 13 DIMM1 Node1/Bank13/MemCard4
DDR2 in use 13 DIMM5 Node1/Bank13/MemCard4
DDR2 in use 14 DIMM2 Node1/Bank14/MemCard4
DDR2 in use 14 DIMM6 Node1/Bank14/MemCard4
DDR2 in use 15 DIMM3 Node1/Bank15/MemCard4
DDR2 in use 15 DIMM7 Node1/Bank15/MemCard4
DDR2 empty 16 DIMM4 Node1/Bank16/MemCard4
DDR2 empty 16 DIMM8 Node1/Bank16/MemCard4
==== On-Board Devices =====================================
==== Upgradeable Slots ====================================
ID Status Type Description
--- --------- ---------------- ----------------------------
1 available PCI Express Node1 PCI-Express Slot 1
2 available PCI Express Node1 PCI-Express Slot 2
3 available PCI Express Node1 PCI-Express Slot 3
4 available PCI Express Node1 PCI-Express Slot 4
5 in use PCI Express Node1 PCI-Express Slot 5
6 available PCI Express Node1 PCI-Express Slot 6
7 available PCI Express Node1 PCI-Express Slot 7
= xauth =
This sounds like you don't have the standard X applications such as "xauth" on
your PATH. On Solaris this means you need to add "/usr/openwin/bin" to your
PATH environment variable.
= PATH =
So set your path like this:
export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/openwin/bin"
= Create A User =
useradd sjoerd \
-c "Sjoerd Hooft Local Account" \
-d /export/home/sjoerd \
-m \
-s /usr/bin/bash
useradd -c "Sjoerd Hooft Local Account" -d /export/home/sjoerd -m -s /usr/bin/bash sjoerd
> Note that the /home is reserved for system usage and that local users should get a homedir in /export/home
= Locking and Unlocking a user =
Lock: -l
Unlock: -u
user@solbox:~$ sudo passwd -l user1
passwd: password information changed for user1
user@solbox:~$ sudo passwd -u user1
passwd: password information changed for user1
== With Sun Directory Server ==
sjoerd@solaris:/opt/SUNWdsee7/bin$ ./dsutil account-status uid=richard,ou=people,dc=prd,dc=domain
Enter "cn=Directory Manager" password:
"uid=richard,ou=people,dc=prd,dc=domain" is activated.
sjoerd@solaris:/opt/SUNWdsee7/bin$ ./dsutil account-inactivate uid=richard,ou=people,dc=prd,dc=domain
Enter "cn=Directory Manager" password:
"uid=richard,ou=people,dc=prd,dc=domain" has been inactivated.
sjoerd@solaris:/opt/SUNWdsee7/bin$ ./dsutil account-status uid=richard,ou=people,dc=prd,dc=domain
Enter "cn=Directory Manager" password:
"uid=richard,ou=people,dc=prd,dc=domain" is inactivated.
http://docs.oracle.com/cd/E19424-01/820-4809/managing-account-lockout/index.html
= Change default shell of Local User =
This is set in the /etc/passwd file:
user123:x:9613:2013:User 123:/home/user123:/bin/ksh