473,505 Members | 15,036 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing Admins to standard users

347 Contributor
Is there a script that can be run to change a admin user to a standard user? I have a group of users who were given admin rights that don't need them and rather than do this manually, I'd prefer to do it with a script if at all possible.
Oct 14 '11 #1
1 7450
computerfox
276 Contributor
Try running this with sudo
Expand|Select|Wrap|Line Numbers
  1. #!/bin/python
  2. import os
  3. import sys
  4.  
  5. class editor:
  6.  path=None;
  7.  group=None;
  8.  users=None;
  9.  def __init__(self,path,group):
  10.   self.path=path;
  11.   self.group=group;
  12.   self.users=open(self.path).read().split("\n");
  13.  
  14.  def run(self):
  15.   i=0;
  16.   while i < len(self.users)-1:
  17.    print "Removing user " + self.users[i] + " from group " + self.group;
  18.    os.system("dseditgroup -o edit -d " + self.users[i] + " -t user " + self.group);
  19.    i+=1;
  20. if len(sys.argv) < 3:
  21.  print "Please provide filepath and group to remove from...";
  22. else:
  23.  session=editor(sys.argv[1],sys.argv[2]);
  24.  session.run();
  25. print "\n";
  26.  
http://safe.abelgancsos.com/codepost...ect.php?id=386

Hope that helps!
May 21 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1643
by: newsgroupsYOUKNOWWHATTODO | last post by:
Hi Folks, I've been contemplating two things for a php project I'm working on : 1) doing user security stuff (users, admins, super-admins etc), pref. compatible with win32 2) doing...
0
1646
by: Tony | last post by:
We are a software company that builds an ASP.Net web application which implements cookieless sessionState with SQLServer- the session is stored in the url. Our ASPState database has been built...
88
5890
by: Matt | last post by:
Hi folks. Can you help with some questions? I gather that some types supported by g++ are nonstandard but have been proposed as standards. Are the long long and unsigned long long types still...
0
1191
by: Steve | last post by:
Some of my power users create their own SQL Agent jobs. All well and good. However, I don't wish to give them System Administrator privileges, and when they create their jobs, the check box to...
3
2828
by: MLH | last post by:
I was running the following code while logged in as a user belonging only to the Users group. Set usrNew = .CreateUser(Me!UserID) 'The user ID is in a control on the form usrNew.PID =...
6
1411
by: Larry | last post by:
After installing VisualC# Standard, DX9 will not install the debugger. Any other users of C# Standard have similar problems? PS: I ran the complete VStudio .net trial for 60 days and DX9...
1
3026
by: Daniel Passwater via DotNetMonster.com | last post by:
I'm working on a app that displays according to a registry key value. The user needs the ability to update the display, and hense the registry key (via a click event on a popup menu). This all...
6
1956
by: google | last post by:
I have a few general questions. I am working on a new database to be used within my company. I would like to give a couple of people, particularly HR, the ability to add and delete Access users,...
6
5134
by: Jan | last post by:
Hi: I have created a secured database for a client. For various reasons, I don't want the client to have full persmissions for the database; they aren't in the admins group. I have instead tried...
3
2600
by: sbaird | last post by:
Aloha from Hawaii, I'm beating my head on the wall here. I have a recruiting contact managment database I'm trying to create. Managers (there ar 14 of them) have to make a certain number of...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.