Skip to content

Instantly share code, notes, and snippets.

@acacha
Created May 25, 2020 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acacha/d5a256281e803865fc935ad2605c8ed4 to your computer and use it in GitHub Desktop.
Save acacha/d5a256281e803865fc935ad2605c8ed4 to your computer and use it in GitHub Desktop.
addAllPrivileges.sh
#!/bin/bash
#$ sudo net rpc rights list -Uroot -I192.168.1.7
#Enter root's password:
# SeMachineAccountPrivilege Add machines to domain
# SeTakeOwnershipPrivilege Take ownership of files or other objects
# SeBackupPrivilege Back up files and directories
# SeRestorePrivilege Restore files and directories
# SeRemoteShutdownPrivilege Force shutdown from a remote system
# SePrintOperatorPrivilege Manage printers
# SeAddUsersPrivilege Add users and groups to the domain
# SeDiskOperatorPrivilege Manage disk shares
USER="pdavila"
USER1="root"
SERVER_IP="192.168.50.41"
echo "Privileges of user $USER before executing this command:"
/usr/bin/net rpc rights list "$USER" -U $USER -I $SERVER_IP
echo
for privilege in SeMachineAccountPrivilege SeTakeOwnershipPrivilege SeBackupPrivilege SeRestorePrivilege \
SeRemoteShutdownPrivilege SePrintOperatorPrivilege SeAddUsersPrivilege SeDiskOperatorPrivilege ; do
/usr/bin/net rpc rights grant "$USER" $privilege -U $USER -I $SERVER_IP
done
echo
echo "Privileges of user $USER after executing this command:"
/usr/bin/net rpc rights list "$USER" -U$USER1 -I$SERVER_IP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment