Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    How to do something to make cmd-shortcuts be root ?

    Reply
    Page 2 of 2 | Prev |   1   2 |
    nicholes | # 11 | 2011-04-11, 07:15 | Report

    Originally Posted by kitwalker View Post
    Use it this way:

    Code:
    sh -c 'echo "sleep 1; echo 0 > /sys/class/backlight/acx565akm/brightness" | sudo gainroot'
    i used shorcut maker and created a shortcut for this thanks!!

    how can i make shortcut for python????? se my code in post #2

    Edit | Forward | Quote | Quick Reply | Thanks

     
    cooperpeng | # 12 | 2011-04-11, 07:44 | Report

    I use this way.
    In your app.py python file.
    Code:
    import os
    os.system('sh -c \'echo "sleep 1; echo 0 > /sys/class/backlight/acx565akm/brightness" | sudo gainroot\'')
    I just change my code like this way. You can try it.
    PS: note \'

    Edit | Forward | Quote | Quick Reply | Thanks

     
    nicholes | # 13 | 2011-04-11, 08:37 | Report

    i don't have any .py file, i just type this in xterminal


    python


    import gst
    bin = gst.element_factory_make("camerabin")
    bin.set_property("videoenc", gst.element_factory_make("dspmp4venc"))
    bin.set_property("videomux", gst.element_factory_make("hantromp4mux"))
    bin.set_property("audioenc", gst.element_factory_make("nokiaaacenc"))
    bin.set_state(gst.STATE_PLAYING)
    bin.set_property("filename", "test.mp4")
    bin.set_property("mode",1)
    #starts recording
    bin.emit("user-start")

    # wait some time

    # stops recording
    bin.emit("user-stop")
    bin.set_state(gst.STATE_PAUSED)
    bin.set_state(gst.STATE_NULL)

    this code starts n900s camera and u can lock screen while video rec.
    and now i want one shortcut for this. plz help

    Edit | Forward | Quote | Quick Reply | Thanks

     
    xantoz | # 14 | 2011-09-09, 17:07 | Report

    Hello, since I do develop/maintain/something cmd-shortcuts I thought it good to reply.

    I used to assume just typing in "sudo command" would work for most people, but realised it was because of the file /etc/sudoers.d/chroot.sudoers, added by package easy-chroot (dependency of easy-debian), containing a line allowing anything to be run as root. As a solution one might try to add something similar to:
    Code:
    user ALL = NOPASSWD: ALL
    to a new file in /etc/sudoers.d/ (maybe cmd-shortcuts.sudoers).
    Otherwise a workaround that seems to work is:
    Code:
    echo 'your command' | sudo gainroot
    in the command field of the button/shortcut you're creating in case your setup doesn't allow just any command to be run with sudo without giving any password (don't know if this "running any command without password with sudo"-business actually is too good of an idea, but easy-chroot added it for me as I said).

    I might add a checkbox "Run as root" implementing a commonly working workaround, maybe intelligently sensing what could work out of a set of alternatives even, in a future version. Hopefully I'll come around to it soon since I've started to notice other tweaks that could be useful (like having a tree structure to sort stuff out when you have many buttons). Alternatively I might do something like adding a /etc/sudoers.d/cmd-shortcuts.sudoers in the default install (hey, easy-chroot does it...).

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by xantoz; 2011-09-09 at 17:20.

     
    Page 2 of 2 | Prev |   1   2 |
vBulletin® Version 3.8.8
Normal Logout