473,385 Members | 1,409 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,385 software developers and data experts.

Hi, from my login i want to login as a other user ,

Hi, from my login i want to login as a other user , how can i do it
using python.

Nov 9 '05 #1
7 1471
sumi wrote:
Hi, from my login i want to login as a other user , how can i do it
using python.


http://www.catb.org/~esr/faqs/smart-questions.html

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Nov 9 '05 #2
Hi, i am very new to python , it is just 2 days i started reading abt
it. I did not understand the above statement. what i want to do is , i
want to login as a super user eg :
$su xyz , and then i need to enter the passwd, i want to do these steps
using python , how can i do it??????????

Nov 9 '05 #3
sumi wrote:
Hi, i am very new to python , it is just 2 days i started reading abt
it. I did not understand the above statement. what i want to do is , i
want to login as a super user eg :
$su xyz , and then i need to enter the passwd, i want to do these steps
using python , how can i do it??????????


You're probably looking for the setuid() and setgid() functions in the
module `os`.

-- Gerhard

Nov 9 '05 #4
On Wed, 09 Nov 2005 04:01:00 -0800, sumi wrote:
Hi, i am very new to python , it is just 2 days i started reading abt
it. I did not understand the above statement. what i want to do is , i
want to login as a super user eg :
$su xyz , and then i need to enter the passwd, i want to do these steps
using python , how can i do it??????????


Type ctrl-d to exit Python, then at the command prompt, type su <enter>,
then type your root password.

Then, as root, type python <enter> at the command prompt.
--
Steven.

Nov 9 '05 #5
sumi wrote:
Hi, i am very new to python , it is just 2 days i started reading abt
it. I did not understand the above statement. what i want to do is , i
want to login as a super user eg :
$su xyz , and then i need to enter the passwd, i want to do these steps
using python , how can i do it??????????

Welcome to Python. The reference to the web page was intended to
indicate that you hadn't made your needs very clear.

Are you aware that "su" creates another process? Also, when it asks for
the password it works *very* hard to ensure that it reads *from the
keyboard* rather than just from standard input.

So, all in all, I'm not sure you really understand what you want to do -
this is not intended as criticism, just that you probably need to step
one pace back, look at things a little larger, and say something that
will give us a bit more context, like:

"My boss tells me we have to be able to run admin commands from inside
the order processing suite. Can anyone tell me how to do this?".

If you *do* understand what you want to do then I'm afraid you still
need to explain yourself more clearly.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Nov 9 '05 #6
On 9 Nov 2005 04:01:00 -0800, sumi <su*****@yahoo.com> wrote:
Hi, i am very new to python , it is just 2 days i started reading abt
it. I did not understand the above statement.
This one?

http://www.catb.org/~esr/faqs/smart-questions.html

You really should try to understand it.
what i want to do is , i
want to login as a super user eg :
$su xyz , and then i need to enter the passwd, i want to do these steps
using python , how can i do it??????????


What you're probably thinking of is expect-like functionality.
Yes, there's a Python module for doing that, on Unix at least:

"Pexpect - a Pure Python Expect-like module"
http://pexpect.sourceforge.net/

/Jorgen

--
// Jorgen Grahn <jgrahn@ Ph'nglui mglw'nafh Cthulhu
\X/ algonet.se> R'lyeh wgah'nagl fhtagn!
Nov 9 '05 #7
>>>>> sumi <su*****@yahoo.com> writes:
Hi, i am very new to python , it is just 2 days i started reading abt
it. I did not understand the above statement.
Just read the document at the URL given to you.
what i want to do is , i want to login as a super user eg : $su xyz , and
then i need to enter the passwd, i want to do these steps using python ,
how can i do it??????????


This is a slightly better description of the problem. However it's still not
clear what exactly you want to achieve. Do you need to continue running your
python script as the new user? Or do you want to run other commands as teh
new user? In any case, take a look at pexpect
(http://pexpect.sourceforge.net) and see if it fits your purpose.

Ganesan

--
Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA
Web: http://employees.org/~rganesan | http://rganesan.blogspot.com
Nov 11 '05 #8

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

Similar topics

1
by: John Davis | last post by:
I put a little login (username and password textfields) in a web page, and once the user able to login, I want the username and password textfields will disappear, and replace with text " has...
6
by: josephrthomas | last post by:
hi..i am trying to make a login page and i am using access table.. when the user enters his userid and password i want to check the password from the table.. if any user with the userID that is...
19
by: Siobhan | last post by:
Hi What is the recommended way to store a user's database credentials across the pages of a web application so that each time the database is accessed the system doesn't have to ask them for their...
2
by: pv | last post by:
Hi everyone, I need help with following scenario, please: Users are accessing same web server from intranet (users previously authenticated in Active Dir) and from extranet (common public...
18
by: Gleep | last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this. The goal I don't want clients to give out their usernames and passwords to friends, since the site...
1
by: xcelmind | last post by:
Hello Dev. Guru, I want to at this time introduce myself. I am Stanley Ojadovwa by name. I’m a freelance and a newbie in web application development. I’m currently using ASP as my application...
5
by: rockdale | last post by:
Hi, all: I have a website with its own login page. Now one of my clients want their employees log into my website from their website. They want to have their login page (look and feel are...
13
JodiPhillips
by: JodiPhillips | last post by:
G'day, I have a silly and simple problem that I need some guidance with. Due to the way our network is set up, I am unable to use the group permissions for Access and have had to implement log...
2
by: kpg* | last post by:
Hi all, asp.net 2.0 I'm using the login control with no frills to authenticate users. I want to add a value to the user's profile when the user successfully logs in, but I want to do this...
3
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post by:
I want to limit the user only login the system one time at the same time. I don't want him login the system two with the same user at the same time. How to do this? If i have a table to record...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: 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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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.