473,383 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

verify a user

If I have a unix user name, is there a way to verify that the user really
exists and query default group memberships?

--
David Bear
-- let me buy your intellectual property, I want to own your thoughts --
Jan 19 '06 #1
1 1109
On Wed, 18 Jan 2006 18:25:19 -0700,
David Bear <da********@asu.edu> wrote:
If I have a unix user name, is there a way to verify that the user
really exists and query default group memberships?


import pwd
unix_user_name = raw_input( 'enter a user name:' )
try:
print pwd.getpwnam( unix_user_name )
except KeyError:
print unix_user_name, 'does not exist'

There's a grp module for making similar queries against /etc/group (or
the modern equivalent thereof).

Regards,
Dan

--
Dan Sommers
<http://www.tombstonezero.net/dan/>
Jan 19 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Dan Williams | last post by:
Apologies for the cross-post but i thought i'd aim for the largest audience possible. I have a web site that users have to register to with their email address. The site then emails the user...
0
by: neuge | last post by:
I am trying to write a Change password process to change user password on an Oracle 8i database with a Powerbuilder client. When the PL/SQL function supplied by Oracle (Verify Password) is...
4
by: Reader | last post by:
I have an application that allows a user to enter a user name, user password, and the domain or machine name. From this information I would like to verify the user account and password is valid. ...
1
by: losway | last post by:
Hi everyone, Firstly i would like to thank everyone for their help and suggestions. However, i still could not fulfil my boss request. Here what i need to do: Original: SQL> set verify on...
3
by: Martin Hazell | last post by:
I am writing an app that requires somebody to be a domain user on our internal network. As our users have a habit of leaving their desktops logged in, I would like them to retype their domain...
43
by: Xancatal | last post by:
Hey everybody. I need help on this one. I need to verify that a number entered by a user is not either a negative number (-100.00), or an alphabet (a, b, c, X, Y) as well as other number other than...
2
by: igotyourdotnet | last post by:
I'm doing some error handling in my app, and I want to add something for the db connectiion. Is there a way to check to verify the db is up and running before I do anything with my app? example:...
8
by: SBC News Groups | last post by:
I have a field on a form that when a user enters a number, I want to verify that the number is already in another table. For example: If a user enters 100 in the control Bidder, I want to check...
3
by: Grey | last post by:
I have to write a program to verify email address availability. i have to verify thousand of email address. is there any way to verify the email in ..net instead. the requirement is to verify which...
7
by: =?Utf-8?B?Tmlrb2xheSBQb2Rrb2x6aW4=?= | last post by:
Good afternoon, community! How you help me? I need to know, how could I verify e-mail address? I don't mean ( for example: test@test.com it is valid or not) I wanna know is that real world...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.