473,513 Members | 2,658 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 7451
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
1645
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
1648
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
5892
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
1193
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
3027
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
2601
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
7257
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
7157
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7521
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
5682
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
5084
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
3232
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
455
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.