ls

This option is only available for compatibility with POSIX; it is used to display the group name in the long (-l) format output (the owner name is suppressed).

dscl

Get a list of all users’ short names:

dscl . -list /Users

Get detailed user info on a particular user:

dscl . -read /Users/

Get a particular value in a user’s info:

dscl . -read /Users/ 

Example of are UniqueID

Get detailed user info for all users:

dscl . -readall /Users

Get a particular value in all users’ info:

dscl . -readall /Users 

clearaccountpolicies

Global policies apply to both admin users and regular users in macOS. Be careful when you set your policies so that you don’t inadvertently lock out admin users.

Use these steps to unlock affected user accounts, including admin users.
If you lock out an Open Directory admin

In Terminal, use this command:

sudo pwpolicy -n /LDAPv3/ldapi://%2Fvar%2Frun%2Fldapi clearaccountpolicies 

If you lock out a local admin

Start the computer in single user mode. To start in single user mode, hold Command-S at startup.

Use the following commands to remove the global password policy when the shell prompt appears:

/sbin/fsck -fy

/sbin/mount -uw /

/bin/launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist

/usr/bin/pwpolicy -n /Local/Default clearaccountpolicies
After entering the commands, press Control-D to restart the computer normally.

Reset the Open Directory administrator password

Reset the Open Directory administrator password

You can reset the Open Directory administrator password for macOS Server without affecting user data. If an administrator departs without leaving their password, this is the best way to access their account.

On the Open Directory server, open Terminal and use this command:
ldapsearch -LLL -x -H ldap://127.0.0.1 -s base namingContexts
In the output, look for the dc= entries, such as dc=ldap1,dc=example,dc=com. Note these entries.

Log in to the server as an administrator.

Open Terminal, then use the following command. Replace the sample dc= entries with the entries you noted before. Also, if the directory administrator account’s uid is not diradmin, change the command accordingly.

sudo ldappasswd -x -H ldapi://%2Fvar%2Frun%2Fldapi -S uid=diradmin,cn=users,dc=ldap1,dc=example,dc=com

Enter your administrator account password when prompted.

At the “New Password:” prompt, enter the new directory administrator password you want to use. Enter it again when prompted.

https://support.apple.com/en-us/HT200182

rsync

rsync -avE –progress /Users/username/Desktop/example_file.tif /Volumes/OpenShare/RSYNC_TEST

source -> destination

The flags are:

v increases verbosity.
a applies archive settings to mirror the source files exactly, including symbolic links and permissions.
E copies extended attributes and resource forks (OS X only).
progress provides a count down and transfer statistics during the copy.

sudo, is used to ensure rsync has appropriate rights to access and read all files on your drive regardless of owner. This also allows rsync to write the files to the new drive recreating the original owner information.

rsync is likely the best choice because it can be rerun in case of problems, offers detailed logging, and is as fast as can be while remaining safe.

 

link: https://apple.stackexchange.com/questions/117465/fastest-and-safest-way-to-copy-massive-data-from-one-external-drive-to-another

passwd can change passwords

passwd can change passwords. dscl can also change a password for an account (in this case the xadmin account) using the passwd extension:

dscl . -passwd /Users/xadmin

https://www.macissues.com/2014/05/31/how-to-change-or-reset-your-password-in-os-x/

http://community.centrify.com/t5/Community-Tech-Blog/How-to-create-a-Hidden-Local-Admin-account-on-Mac-systems-Redux/ba-p/14649#