[Gambas-user] Gambas app run as root

Stefano Palmeri rospolosco at ...152...
Sun Oct 3 19:05:02 CEST 2010


Il domenica 3 ottobre 2010 18:46:38 Jussi Lahtinen ha scritto:
> No, with Ubuntu 10.04 it does not work.
> Textbox.Text is "", because shell is executed before textbox is even shown.
>
> Your original code gives result:
> *Password:
> Password:
> su: Authentication failure*
> Then form appears, and after that when write password and click "confirm",
> you will get error message from gambas "System error. Bad file descriptor".
> Error is given from line:
> *PRINT #hProcess, TextBox1.Text*
>
> Jussi

Well, I'm on Slackware 32 bit. I switch the code to gb.gtk and still works 
here. I don't know. Maybe a Ubuntu 64 bit issue? 

>Then form appears, and after that when write password and click "confirm",
> you will get error message from gambas "System error. Bad file descriptor".

I get this error when I try a second time, because after the first try 
the code inside Form_Open is not run again. It was an example on the fly
to show howto su. 

Change the Button_Click code to:

PUBLIC SUB Button1_Click()
  
  PRINT #hProcess, TextBox1.Text
  WAIT 
  TRY hProcess.Kill
  hProcess = SHELL "su -c 'ls /root'" FOR INPUT OUTPUT 
       
END
 
This should fix the Bad descriptor error. For the first error I suppose is 
something with 64 bit. don't know.





>
> On Sun, Oct 3, 2010 at 18:18, Stefano Palmeri <rospolosco at ...152...> wrote:
> > Il domenica 3 ottobre 2010 15:04:15 Jussi Lahtinen ha scritto:
> > > I looked your example just for interest.
> > > It doesn't seem to work with Ubuntu 10.04 64bit.
> > >
> > > There are two issues, maybe something with my system...
> > > This is first time I used "*su*" (normally I use sudo) on this
> > > computer, and it doesn't work...
> > > *su -c 'whoami'*
> > > gives;
> > > *su: Authentication failure*
> > >
> > > However *sudo whoami* works correctly.
> > > Because of that, I replaced *su -c 'ls /root'* with *sudo whoami*.
> > >
> > > But there is another problem. Shell doesn't wait for input for *su* or
> > > *sudo *.
> > > Result is *sudo: 3 incorrect password attempts*, before even textbox
> > > appears.
> > >
> > > Tested with Gambas2 revision 3124.
> > > Jussi
> >
> > I made this example just for 'su'. with 'su' it works, at least while
> > the textbox in not "". Anyway, good to know.
> >
> > Tested with:
> >
> > Gambas 2.20
> > Qt 3.3.8b
> > Gtk 2.12.12
> >
> > under KDE, so it uses gb.qt.
> >
> > Regards.
> >
> > > On Sat, Oct 2, 2010 at 15:22, Stefano Palmeri <rospolosco at ...152...>
> >
> > wrote:
> > > > Il venerdì 1 ottobre 2010 21:27:39 IMP Technologies - Tajinder Singh
> > > > ha
> > > >
> > > > scritto:
> > > >> Hi all,
> > > >>
> > > >> I am new to Gambas but have done some projects in Visual Basic at
> > > >> college time.
> > > >>
> > > >> It is a good feeling to know about Gambas which I can use to create
> > >
> > > helpful
> > >
> > > >> applications on Linux platforms.
> > > >>
> > > >> I have created a small basic interface for Fedora to change Plymouth
> > >
> > > theme.
> > >
> > > >> But as changing theme requires to run some commands as root, I would
> > > >> like to ask for root password before starting the application.
> > > >> Similarly whenever we run 'system-config-boot' or other software
> > > >> that requires root privileges.
> > > >>
> > > >> Please help me with detailed guidance as how I can achieve the
> > > >> result.
> > > >>
> > > >>
> > > >> Thanks & Regards,
> > > >
> > > > Hi.
> > > >
> > > > I've attached a little example. It's just an interface to su. You
> > > > don't need kdesu or gksu. The code is real simple. It asks for root
> > > > password to execute 'su -c ls /root'. Take a look.
> > > >
> > > > Bye,
> > > >
> > > > Stefano
> > > >
> > > >> Tajinder Singh
> > > >> MD & CEO
> > > >> IMP Technologies
> > > >> [Affordable :: Quality :: Satisfaction]
> > > >> Mb. : +91-9814943801
> > > >> Tel. : +91-161-2541944
> > > >> E-mail : imp.tsingh at ...626...
> > > >> Web : http://www.imptechs.com
> > > >> V-Card : http://www.imptechs.com/misc/IMPTechnologies_V-Card.jpg
> >
> > -------------------------------------------------------------------------
> >--
> >
> > > >>--- Start uncovering the many advantages of virtual appliances
> > > >> and start using them to simplify application deployment and
> > > >> accelerate your shift to cloud computing.
> > > >> http://p.sf.net/sfu/novell-sfdev2dev
> > > >> _______________________________________________
> > > >> Gambas-user mailing list
> > > >> Gambas-user at lists.sourceforge.net
> > > >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> > -------------------------------------------------------------------------
> >--
> >
> > >---
> > >
> > > > Start uncovering the many advantages of virtual appliances
> > > > and start using them to simplify application deployment and
> > > > accelerate your shift to cloud computing.
> > > > http://p.sf.net/sfu/novell-sfdev2dev
> > > > _______________________________________________
> > > > Gambas-user mailing list
> > > > Gambas-user at lists.sourceforge.net
> > > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> > -------------------------------------------------------------------------
> >--
> >
> > >--- Start uncovering the many advantages of virtual appliances
> > > and start using them to simplify application deployment and
> > > accelerate your shift to cloud computing.
> > > http://p.sf.net/sfu/novell-sfdev2dev
> > > _______________________________________________
> > > Gambas-user mailing list
> > > Gambas-user at lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> > -------------------------------------------------------------------------
> >----- Start uncovering the many advantages of virtual appliances
> > and start using them to simplify application deployment and
> > accelerate your shift to cloud computing.
> > http://p.sf.net/sfu/novell-sfdev2dev
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
> ---------------------------------------------------------------------------
>--- Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user






More information about the User mailing list