First, a few things to note:
On the Mac the files /etc/passwd
and /etc/master.passwd
are only consulted when the Mac is booted into single user mode.
I'm not sure what you mean by "set the master password" for the Mac. Do you mean set the password for the account 'root'?
Usually you use the passwd
command to change passwords from the command line (there is no master.passwd
command) but you can't use it from a script as it requires input.
To change a password in a script you need to use the dscl
command.
Here is an example :
dscl . -passwd /Users/tonyw newpass
Note that the above would have to be run as root, which means your script would have to be run by root. Otherwise you have to add authentication to the dscl command thus:
dscl . -u Admin -P adminpassword -passwd /Users/tonyw newpass
The user Admin
must have administrator privileges for the Mac.
(All of this is incredibly insecure as you have passwords in plain text in a script.)
Of course to set the password for 'root' just change the tonyw
to root
in the above.
Have a good look at dscl(1)
to understand the options in the above.
As far as I can tell reg
is only available in Lion (/usr/bin/reg and /usr/share/man/man1/reg.1). I haven't been able to find it in any other system version in the 10.6 - 10.11 range.
Executing it in 10.10 works but I think some hardware data is missing. E.g my CPUs weren't recognized and I can't list any PCI device. Depending on the hardware your mileage will vary.
Best Answer
In OS X's version of
top
the field is called STATE and it shows you what state the process is in. For information on thestuck
state see: https://apple.stackexchange.com/a/58718/292The
ps
command on OS X can also show process status. For example,ps aux
includes theSTATE
field. And the ps man page has this to say about the field: