[Zope] useradd command in Zope
Hi , how to use command that require Root privileges like useradd,reading shadow file bca'z i install zope as non root user now i need to use useradd command in my application ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] useradd command in Zope
> useradd ... On 11/3/05, Andreas Jung <[EMAIL PROTECTED]> wrote: Look at the sudo command (man sudo). This is basically a non-Zope question.> i don't think this is non-zope question bca'z... i am using python script to add user to system which works fine when run outside of zope ... but when i run it through zope as external script (with all permission) it's not working and returning 256 without giving any error... ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] useradd command in Zope
i did the same but still not working.On 11/3/05, Tino Wildenhain <[EMAIL PROTECTED]> wrote: ajit mote schrieb:> > useradd ...>> On 11/3/05, *Andreas Jung* <[EMAIL PROTECTED]> [EMAIL PROTECTED] >> wrote:>> Look at the sudo command (man sudo). This is basically a non-Zope> question.>> > i don't think this is non-zope question bca'z...>>i am using python script to add user to system which works fine > when run outside of zope ...> but when i run it through zope as external script (with all> permission) it's not working and returning 256 without giving any error...>as root, su zopeuser first and then try your script. Zopeuser meaning the user account your zope runs.Again, double and tripple check if you secured thisapplication in any way before opening it to the web. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] useradd command in Zope
this is what i tried #External script addUser.py (stored in instance/Extensions folder) import crypt import os def addUser(userName,password): password=crypt.crypt(password,"5Ag5zoM9") command="/usr/sbin/adduser -p "+password+" "+ userName return os.system(command) /// attaching the application exported from zope2.8.1 ,python-2.3.4-11,mysql-3.23.58-13 and Linux 2.6.9-1.667 now i hope that , problem defination is very clear and open.. /// On 11/7/05, Tino Wildenhain <[EMAIL PROTECTED]> wrote: Am Montag, den 07.11.2005, 09:32 +0530 schrieb ajit mote:> i did the same but still not working.>> On 11/3/05, Tino Wildenhain <[EMAIL PROTECTED]> wrote: > ajit mote schrieb:> > > useradd ...> >> > On 11/3/05, *Andreas Jung* <[EMAIL PROTECTED]> > [EMAIL PROTECTED]>> wrote:> >> > Look at the sudo command (man sudo). This is basically a> non-Zope> > question.> >> > > i don't think this is non-zope question bca'z...> >> >i am using python script to add user to system which> works fine> > when run outside of zope ...> > but when i run it through zope as external script> (with all> > permission) it's not working and returning 256 without> giving any error...> >>> as root, su zopeuser first and then try your script. > Zopeuser meaning the user account your zope runs.>> Again, double and tripple check if you secured this> application in any way before opening it to the web.Try harder :-) Seriously, what should we do to help you? If something isn'tworking as expected, give us the code you try, theenvironment and exact error messages, preferably tracebacks. addUser.zexp Description: Binary data ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] useradd command in Zope
On 11/7/05, Tino Wildenhain <[EMAIL PROTECTED]> wrote: ajit mote schrieb: > this is what i tried >> #External script addUser.py (stored in instance/Extensions folder)> import crypt> import os > def addUser(userName,password):> password=crypt.crypt(password,"5Ag5zoM9") > command="/usr/sbin/adduser -p "+password+" "+ userName > return os.system(command)>Heaven! Is this external method available via web? If so be prepared for massive attack :-)That aside you may consider md5 instead of crypt to make it not too easy to crack (otoh, its not really importantas your script really allows for any command) > as we are going to use application only in intranet . we are developing this web application only for our purpose ie. using only inside our firm my sys admin allow me to do this so no security problem > ///> attaching the application > exported from zope2.8.1 ,python-2.3.4-11,mysql-3.23.58-13 and> Linux 2.6.9-1.667 > > now i hope that , problem defination is very clear and open..> /// Well no, at least not your "it does not work" problem you told us.Still missing: the call to the script as "User which runs zope"which might be zope or nobody or something, depending on your configuration and the way you start zope.Add the following lines to your external method and you canrun it as script too:if __name__=='__main__':import systry: user=sys.argv [1] pass=sys.argv[2]except IndexError: sys.stderr.write("Please start me with %s \n" % sys.argv[0]) sys.exit(20) addUser(user,pass) and try it like this:su zope (or whoever your zope runs)./yourmethod.py someuser somepassYou will see it fail (apart from the fact you needthe #!/path/to/python.bin and set the execution bit with chmod a+x before you try) > i tried using another user outside of zope . working very well(adding user to system) owner of external method is root and set_user_id bit is set. but problem is when i run attached app it is not adding user Because you did not use sudo as adviced.Please try to copy the way mails are cited from other mails in this list. Dont put all your text on thetop of a full quote. Thank you.RegardsTino > i am really sorry for the same ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )