Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

0 views
Skip to first unread message

sumi

unread,
Nov 9, 2005, 5:46:24 AM11/9/05
to
Hi, from my login i want to login as a other user , how can i do it
using python.

bruno at modulix

unread,
Nov 9, 2005, 6:44:48 AM11/9/05
to
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 'on...@xiludom.gro'.split('@')])"

sumi

unread,
Nov 9, 2005, 7:01:00 AM11/9/05
to
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??????????

Gerhard Häring

unread,
Nov 9, 2005, 7:21:37 AM11/9/05
to pytho...@python.org

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

-- Gerhard

Steven D'Aprano

unread,
Nov 9, 2005, 11:12:40 AM11/9/05
to

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.

Steve Holden

unread,
Nov 9, 2005, 1:15:35 PM11/9/05
to pytho...@python.org
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/

Message has been deleted

Ganesan Rajagopal

unread,
Nov 9, 2005, 11:24:42 AM11/9/05
to pytho...@python.org
>>>>> sumi <sum...@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


0 new messages