Created
May 25, 2020 12:21
-
-
Save acacha/d5a256281e803865fc935ad2605c8ed4 to your computer and use it in GitHub Desktop.
addAllPrivileges.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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