Problem running sudo command in script

Hello,
I try to run this script.
#!/bin/bash
sudo /bin/cat /dev/input/event1 >> /home/tom/.log/log.bin &
The sudoers entry
%users ALL= NOPASSWD: /bin/cat /dev/input/event1 >> /home/tom/.log/log.bin
I get the following error!
$ Passwort: sudo: pam_authenticate: Kommunikationsfehler
Kommunikationsfehler = eng: communication error
What's wrong with that?
Thank you!
clementis

Sorry, for being not precise.
I created the alias in .bashrc in my $home directory. In sudoers all users are allowed to key in this command without a passwort entry.
I know how to autostart in xfce and so created an autostart entry but unfortunatly it doesn't work for my "special" command.
What I did:
1. I wrote a script (first post) and tried to autostart it in xfce. For that command I created an entry in sudoers in order to avoid enter root passwort. The script didn't start.
Then...
2. I created an autostart entry (deleted the first one - see point 1) and entered the whole command (cat .../event1 >> $home...) in the xfce autostart input window. The idea was to run the command directly and not through a script. But it didn't work.
Therefore I tried to run alter the command to "bash cat .../event1 >> $home ...." Didn't work either.
3. I also deleted the autostart entry no 2. and created the alias in .bashrc in my home directory. Now created a new autostart entry trying to start the alias. Didn't work.
I also tried to set the Terminal option in the file $home/.config/autostart/log.desktop to "true".
So it looked like this:
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=log
Comment=event1
Exec= sudo cat /dev/input/event1 >> /home/tom/.cblog/log.bin &
StartupNotify=false
Terminal=true
Hidden=false
The alias for example works well if I enter it in xterm.
So, I don't know why it isn't working! :-(
Thank you for any help
Clementis

Similar Messages

  • How to create script that run sudo-command, via automator?

    Hi
    I'd want to create script to automate one command I need quite often. I just can't get this to work.
    I'm not using english OS, but I think this is what I do. In automator I choose Utilities -> Run script
    Here's the script I try to run:
    sudo "/Library/Application Support/VMware Fusion/boot.sh --restart"
    I found some tip to do it like this:
    do shell script "sudo /Library/Application Support/VMware Fusion/boot.sh --restart password "pass" with administrator privileges
    Where pass is my admin password.
    This does not work, either.
    Could anybody help me on this?
    Thanks...
    Tomi Toivonen
    Message was edited by: Tomi

    This is not working. What's wrong?
    What's wrong is that the '--restart' is a parameter for boot.sh, and therefore needs to be included within the quotes.
    Additionally, the shell uses spaces to divide parameters, so the spaces in the command will make it appear as multiple commands - '/Library/Application', 'Support/VMware' and 'Fusion/boot.sh'. You need to escape them using a backslash:
    <pre class=command>do shell script "/Library/Application\ Support/VMware\ Fusion/boot.sh --restart" password "pass" with administrator privileges</pre>
    If it's outside of the quotes it would be interpreted as a parameter to 'do shell script' and it won't know what to do with that.

  • How to create script that run sudo-command?

    I often need to run command:
    sudo "/Library/Application Support/VMware Fusion/boot.sh" --restart
    This needs to be run as admin.
    Can anybody tell me how to create script that will login as admin and run that command in terminal?
    Or from where can I get help how to add commands to a script?
    Thanks
    Tomi

    Your best bet on getting a cogent answer is to post to the Unix forum under OS X Technologies.

  • Applescript for running sudo commands in terminal

    I'm a newbie when it comes to Applescript and was wondering if someone could help with a basic request. I need to write a small script to do the following:
    1. Launch terminal
    2. Run the 'Sudo -s' command
    3. Enter the administrator password (in plain text)
    and then
    4. run some sudo commands like "sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array-add administrator"
    I actually WANT the administrator password to be in the script in plain text even though I understand the security risks (I will literally be the only person to ever see the script). I've trawled forums all over but can't seem to find what I am looking for and cannot get it working by patching together the various commands I have found. Thanks in advance for any help you can give!
    Sean

    I've included two examples.  The preferred way & the hacker way.
    with administrator
    It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.
        Author: rccharles
        For testing, run in the Script Editor.
          1) Click on the Event Log tab to see the output from the log statement
          2) Click on Run
        For running shell commands see:
        http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
    on run
        -- Write a message into the event log.
        log "  --- Starting on " & ((current date) as string) & " --- "
        --  debug lines
        set unixDesktopPath to POSIX path of "/System/Library/User Template/"
        log "unixDesktopPath = " & unixDesktopPath
        set quotedUnixDesktopPath to quoted form of unixDesktopPath
        log "quoted form is " & quotedUnixDesktopPath
        try
            set fromUnix to do shell script "sudo ls -l  " & quotedUnixDesktopPath with administrator privileges
            display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
        on error errMsg
            log "ls -l error..." & errMsg
        end try
    end run
    This version has an inline password.
    Notice the echo 'password' |
    The single quotes are no accident.
    It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.
        Author: rccharles
        For testing, run in the Script Editor.
          1) Click on the Event Log tab to see the output from the log statement
          2) Click on Run
        For running shell commands see:
        http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
    on run
        -- Write a message into the event log.
        log "  --- Starting on " & ((current date) as string) & " --- "
        --  debug lines
        set unixDesktopPath to POSIX path of "/System/Library/User Template/"
        log "unixDesktopPath = " & unixDesktopPath
        set quotedUnixDesktopPath to quoted form of unixDesktopPath
        log "quoted form is " & quotedUnixDesktopPath
        try
            set fromUnix to do shell script "echo 'password' | sudo ls -l  " & quotedUnixDesktopPath
            display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
        on error errMsg
            log "ls -l error..." & errMsg
        end try
    end run

  • [SOLVED] Running sudo command to be executed on dmenu

    I'm using "sudo grub-reboot 2". What is the best way to run this command with dmenu, considering that sudo is necessary, without sacrificing security?
    Last edited by Quatro (2014-08-19 00:22:24)

    My dmenu power menu script looks like this.
    power_menu.sh
    #!/bin/bash
    # dmenu2 power menu
    OPT=$(echo -e "suspend\npoweroff\nreboot" | dmenu -f -h 28 -fn "Ubuntu Mono-12" -x 460 -y 370 -w 360 -nb black -nf white -sb white -sf black )
    case $OPT in
    suspend) sudo systemctl suspend ;;
    poweroff) sudo systemctl poweroff ;;
    reboot) sudo systemctl reboot ;;
    esac
    And the following file allows me to run those commands without being prompted for a password.
    /etc/sudoers.d/include
    slithery ALL=(ALL) NOPASSWD:/usr/bin/systemctl suspend
    slithery ALL=(ALL) NOPASSWD:/usr/bin/systemctl poweroff
    slithery ALL=(ALL) NOPASSWD:/usr/bin/systemctl reboot
    Just use these as an example and you should get what you're after.
    Last edited by slithery (2014-08-18 11:52:31)

  • Problem with shell commands and scripts from an Applescript Application

    Hi-
    I am fairly new to OSX software development. I am trying to build an application that creates a reverse SSH tunnel to my computer and starts OSXvnc. The idea is that my Mom or anyone else who needs help can connect to me without having to tinker with their firewalls.
    There are plenty of resources on how to do this, and I have found them. What I have a problem with is the following.
    I am building this application in Xcode as an Applescript application, because Applescript and shell scripting are the only forms of programming I know. I use an expect script to connect through SSH, and a "do shell script" for the raw OSXvnc-server application to allow screen sharing.
    The problem is that when I click on the button to launch OSXvnc-server or the button to launch SSH, the application freezes until the process it spawns is killed or finishes. For example, I can set SSH to timeout after 60 seconds of no connection, and then the Applescript application responds again. I even tried using the ssh -f command to fork the process, but that doesn't seem to help.
    I am also using "try" around each of the items.
    What am I doing wrong? How can I make the buttons in my app launch SSH and OSXvnc-server without hanging the application while it waits for them to finish?
    Thanks so much!

    See here for an explanation of the syntax.
    (20960)

  • ODAC 11.10.7: Problems running Post-installation SQL Scripts"

    Hello:
    I am running the 32-bit version of 11g Release 1.
    I installed ODAC version 11.10.7. The installation was completed without error but advised to run the SQL scripts found in OracleHome\ASP.net\SQL.
    I logged in using SYS account and tried to execute the SQL file, InstallAllOracleASPNETProviders.SQL which calls other SQL scripts:
    @@InstallOracleASPNETCommon.sql
    @@InstallOracleMembership.sql
    @@InstallOraclePersonalization.sql
    @@InstallOracleProfile.sql
    @@InstallOracleRoles.sql
    @@InstallOracleSiteMap.sql
    @@InstallOracleWebEvents.sql
    -- Install OracleSessionState Provider
    -- For Oracle 10gR1(10.1.0.2) database and higher, run InstallOracleSessionState.sql
    -- For Oracle 9iR2(9.2.x) database, run InstallOracleSessionState92.sql instead
    @@InstallOracleSessionState.sql
    --@@InstallOracleSessionState92.sql
    The first SQL was executed without any error.
    However, I received the following error with the second file:
    "ORA-06550: line 2, column 11: PLS-00201: identifier 'ORA_ASPNET_TABLEEXISTS' must be declared
    ORA-06550: line 2, column 6:
    PL/SQL: Statement ignored"
    The offending line has a reference to a function:
    IF ( ora_aspnet_TableExists('ORA_ASPNET_MEMBERSHIP') = 0) THEN
    Can someone advise on what needs to be done?
    venki
    Edited by: user9023421 on Apr 18, 2011 2:28 PM

    I did not have any Macromedia file in syetem 32 when I last replied to your question. I had uninstalled FP 11.8, but my embedded FP on Windows 8 was (and is) still showing in Control Panel Items but did not and does not appear when checking version on the Adobe Find Version page.
    Before reading your last reply, I did UNinstall 11.8 and then installed flashplayer_11_7_plugin_debug   (FP 11.7.700.232).
    This NOW shows up as Shockwave Flash ver. 11.7.700.232 in mozilla add-ons manager and is listed in system32 as a folder: C:\Windows\system32\Macromed with many files in the folder.
    The Flash Player 11.7.700.232 worked on Mozilla FF 22.0 for several hours before not being able to play some flash content and then crashed. An odd window kept appearing while trying to use it, I did not copy the test of it, but will try and reproduce the problem, and copy and post the text here in a further discussion box on our discussion.  A subsequent check to Adobe Find Version page shows that FP 11.7.700.232 is CURRENTLY installed and functoning. But it still does not play all Flash content that I encounter on the internet.
    I did NOT use the Adobe Full Installer to install Flash Player 11.7.700.232, I simply downloaded the file to desktop and manually installed it off line.
    If I DO need to uninstall FP 11.7.700.232, and reinstall it using the Adobe Full Installer, please tell me in detail how because I thought that the Full Installer had a different version of FP in it.
    What I mean is, if I download and run the Full Installer, is that also simultaneously installing a different version of FP? Or do I run it and THEN install FP 11.7.700.232?
    Thank you for following along and replying, Pat. I am not very literate with PC's and the problem is likely something that I am doing wrong!

  • Running Unix commands and scripts from HTML-DB

    Hi,
    How can I run scripts (like perl scripts) that I have on the UNIX machine that the HTML_DB is installed on.
    How for a start can I run even simple UNIX command like "ls" ?
    Thanx,
    Alon

    Alon,
    Best to try the database forum and search for "external process" or "extproc" for this - it needs setup for the listener and in the database itself.
    You need to be aware - all your commands will be run as the oracle user so you should be very careful who can run them and what commands they can run.
    Greg

  • Problem running shell command

    hi
    i am just trying to run a simple msdos command
    public class TestImage{
        public static void main(String args[]){
         try{
             Process p=Runtime.getRuntime().exec("echo");
         catch(IOException e){
             System.out.println(e);
    }and i get this error message
    java.io.IOException: CreateProcess: echo error=0
    can someone explain me what's wrong
    thanks

    i ve tried it and the dos shell crashed
    import java.io.*;
    import java.awt.*;
    public class TestImage{
        public static void main(String args[]){
         String output = null;
         BufferedReader input = null;
         String cmd[] = { "command.com", "/c", "echo", "%CLASSPATH% " };
         try {   
             Process process = Runtime.getRuntime().exec(cmd);   
             input = new BufferedReader(new InputStreamReader(process.getInputStream()));   
             while ((output = input.readLine()) != null) {
              System.out.println(output);
         } catch (java.io.IOException ioe) {
             ioe.printStackTrace();

  • PLEASE HELP making a program that uses sudo commands

    hey
    is there anyway to make a program run sudo commands
    i have a problem because in a terminal it would ask you to input a password.
    is there a way to use a fake keyboard program to input the password in the back ground
    of my java application or some how run sudo commands? my application relies on some outputs of these commands.
    please help thanks.

    ill tell you a bit about my program im making.
    i have a wireless usb that i have to switch back and forth to get my paticullar drivers to
    do certain things e.g. one is for web browsing and the other one has packet injection.
    by typing sudo modprobe ect.. i can switch through a terminal. which requires me to type in a password.
    iv made a application which uses the
    Runtime.getRuntime().exec("sudo ...."); it has 2 buttons to switch from diffrent drivers and always runs at start up.
    just a big problem i cant use sudo it just freezes when i start and click on the buttons. and doesnt ask me for a password.
    can anyone help thanks

  • Devtools update causes problems with sudo when used in a script?

    I'm a little confused by this one, but I'm not convinced that it's a bug.. yet.
    Long story short, I compile packages using the ABS via a script/wrapper which uses devtools. The script is available here: https://github.com/WorMzy/compilepackage
    Now, this script is far from perfect, but has worked perfectly well (in various states of completeness) for the past year or so. However, with the recent update of devtools (20120720-1 => 20121013-1), my script fails to execute correctly. After entering the password when prompted (by sudo, at this line: https://github.com/WorMzy/compilepackag … tions#L107), the script terminates unexpectedly.
    Downgrading devtools "fixes" this problem, but I'm not sure if this is a bug in devtools, sudo, zsh, my script, or something else.
    Here is the full output from the compilation of "arch-install-scripts":
    build@sakura[pts/10]:~/builds/devtools$ . ~/.scripts/compilepackage arch-install-scripts
    ==> Downloading sources
    ==> arch-install-scripts directory already exist. Replace ? [Y/n]
    ==> Download arch-install-scripts sources
    receiving file list ... done
    sent 28 bytes received 70 bytes 39.20 bytes/sec
    total size is 656 speedup is 6.69
    :: Synchronizing package databases...
    core is up to date
    extra is up to date
    community is up to date
    :: Starting full system upgrade...
    there is nothing to do
    ==> Building in chroot for [extra] (x86_64)...
    ==> Creating clean working copy...done
    ==> Making package: arch-install-scripts 8-1 (Fri Oct 19 23:45:52 BST 2012)
    ==> Checking runtime dependencies...
    ==> Checking buildtime dependencies...
    ==> Retrieving Sources...
    -> Found arch-install-scripts-8.tar.gz
    -> Found arch-install-scripts-8.tar.gz.sig
    ==> Validating source files with md5sums...
    arch-install-scripts-8.tar.gz ... Passed
    arch-install-scripts-8.tar.gz.sig ... Passed
    ==> Verifying source file signatures with gpg...
    arch-install-scripts-8.tar.gz ... FAILED (unknown public key 1EB2638FF56C0C53)
    ==> WARNING: Warnings have occurred while verifying the signatures.
    Please make sure you really trust them.
    ==> Extracting Sources...
    -> Extracting arch-install-scripts-8.tar.gz with bsdtar
    ==> Starting build()...
    make: Entering directory `/build/src/arch-install-scripts-8'
    GEN arch-chroot
    GEN genfstab
    GEN pacstrap
    make: Leaving directory `/build/src/arch-install-scripts-8'
    ==> Entering fakeroot environment...
    ==> Starting package()...
    make: Entering directory `/build/src/arch-install-scripts-8'
    install -dm755 /build/pkg/usr/bin
    install -m755 arch-chroot genfstab pacstrap /build/pkg/usr/bin
    install -Dm644 zsh-completion /build/pkg/usr/share/zsh/site-functions/_archinstallscripts
    make: Leaving directory `/build/src/arch-install-scripts-8'
    ==> Tidying install...
    -> Purging unwanted files...
    -> Compressing man and info pages...
    -> Stripping unneeded symbols from binaries and libraries...
    ==> Creating package...
    -> Generating .PKGINFO file...
    -> Compressing package...
    ==> Leaving fakeroot environment.
    ==> Finished making: arch-install-scripts 8-1 (Fri Oct 19 23:45:54 BST 2012)
    ==> Installing package arch-install-scripts with pacman -U...
    loading packages...
    resolving dependencies...
    looking for inter-conflicts...
    Targets (1): arch-install-scripts-8-1
    Total Installed Size: 0.03 MiB
    Proceed with installation? [Y/n]
    (1/1) checking package integrity [######################################################################] 100%
    (1/1) loading package files [######################################################################] 100%
    (1/1) checking for file conflicts [######################################################################] 100%
    (1/1) installing arch-install-scripts [######################################################################] 100%
    resolving dependencies...
    looking for inter-conflicts...
    Targets (5): elfutils-0.155-1 pyalpm-0.5.3-2 python-3.3.0-1 python-pyelftools-0.20-2 namcap-3.2.4-2
    Total Installed Size: 99.58 MiB
    Proceed with installation? [Y/n]
    (5/5) checking package integrity [######################################################################] 100%
    (5/5) loading package files [######################################################################] 100%
    (5/5) checking for file conflicts [######################################################################] 100%
    (1/5) installing python [######################################################################] 100%
    Optional dependencies for python
    tk: for tkinter
    sqlite
    (2/5) installing pyalpm [######################################################################] 100%
    (3/5) installing elfutils [######################################################################] 100%
    (4/5) installing python-pyelftools [######################################################################] 100%
    (5/5) installing namcap [######################################################################] 100%
    Checking PKGBUILD
    Checking arch-install-scripts-8-1-any.pkg.tar.xz
    arch-install-scripts W: Dependency bash included but already satisfied
    arch-install-scripts W: Dependency included and not needed ('coreutils')
    arch-install-scripts W: Dependency included and not needed ('pacman')
    arch-install-scripts W: Dependency included and not needed ('util-linux')
    ==> Compilation complete, installing...
    Password:
    loading packages...
    warning: arch-install-scripts-8-1 is up to date -- reinstalling
    resolving dependencies...
    looking for inter-conflicts...
    Targets (1): arch-install-scripts-8-1
    Total Installed Size: 0.03 MiB
    Net Upgrade Size: 0.00 MiB
    Proceed with installation? [Y/n] % build@sakura[pts/10]:~/builds/arch-install-scripts$
    That "%" is inverted, just like what you get when you run
    echo -n "text"
    in zsh. Incidentally, here is my .zshrc: https://github.com/WorMzy/Config-files/ … ter/.zshrc, however, the problem persists with a new user with an unconfigured zsh.
    Here is my sudoers too:
    ## sudoers file.
    ## This file MUST be edited with the 'visudo' command as root.
    ## Failure to use 'visudo' may result in syntax or file permission errors
    ## that prevent sudo from running.
    ## See the sudoers man page for the details on how to write a sudoers file.
    ## Host alias specification
    ## Groups of machines. These may include host names (optionally with wildcards),
    ## IP addresses, network numbers or netgroups.
    # Host_Alias WEBSERVERS = www1, www2, www3
    ## User alias specification
    ## Groups of users. These may consist of user names, uids, Unix groups,
    ## or netgroups.
    # User_Alias ADMINS = millert, dowdy, mikef
    ## Cmnd alias specification
    ## Groups of commands. Often used to group related commands together.
    # Cmnd_Alias PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \
    # /usr/bin/pkill, /usr/bin/top
    ## Defaults specification
    ## You may wish to keep some of the following environment variables
    ## when running commands via sudo.
    ## Locale settings
    # Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"
    ## Run X applications through sudo; HOME is used to find the
    ## .Xauthority file. Note that other programs use HOME to find
    ## configuration files and this may lead to privilege escalation!
    # Defaults env_keep += "HOME"
    ## X11 resource path settings
    # Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
    ## Desktop path settings
    # Defaults env_keep += "QTDIR KDEDIR"
    ## Allow sudo-run commands to inherit the callers' ConsoleKit session
    # Defaults env_keep += "XDG_SESSION_COOKIE"
    ## Uncomment to enable special input methods. Care should be taken as
    ## this may allow users to subvert the command being run via sudo.
    # Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
    ## Uncomment to enable logging of a command's output, except for
    ## sudoreplay and reboot. Use sudoreplay to play back logged sessions.
    # Defaults log_output
    # Defaults!/usr/bin/sudoreplay !log_output
    # Defaults!/usr/local/bin/sudoreplay !log_output
    # Defaults!/sbin/reboot !log_output
    Defaults timestamp_timeout=0,passwd_timeout=0,passprompt="Password:",badpass_message="Incorrect password",editor=/usr/bin/vim:/usr/bin/vi,targetpw
    ## Runas alias specification
    ## User privilege specification
    root ALL=(ALL) ALL
    build sakura=/usr/bin/pacman-color -U *,/usr/bin/pacman-color -Sy,/usr/bin/pacman-color -Syy
    build sakura=/usr/bin/pacman -U *
    build sakura=NOPASSWD: /usr/bin/extra-x86_64-build,/usr/bin/multilib-build,/usr/sbin/makechrootpkg
    ## Uncomment to allow members of group wheel to execute any command
    %wheel sakura=(ALL) ALL
    ## Same thing without a password
    #%wheel ALL=(ALL) NOPASSWD: /sbin/sdshutdown, /sbin/sdreboot
    ## Uncomment to allow members of group sudo to execute any command
    # %sudo ALL=(ALL) ALL
    ## Uncomment to allow any user to run sudo if they know the password
    ## of the user they are running the command as (root by default).
    # Defaults targetpw # Ask for the password of the target user
    # ALL ALL=(ALL) ALL # WARNING: only use this together with 'Defaults targetpw'
    ## Read drop-in files from /etc/sudoers.d
    ## (the '#' here does not indicate a comment)
    #includedir /etc/sudoers.d
    Further information will be provided on request. Suggestions for improving the script will also be appreciated.
    Thanks.

    Update: It appears that the cause is systemd's nspawn. Disabling it in mkarchroot (have_nspawn=0) resolves the problem.
    However, I don't understand why it's causing this behaviour. User input works fine for the sudo password prompt, but then fails for the pacman user prompt? Do they use different input buffers or something? Does that question even make sense?
    Anyway, I'll open a bug report on flyspray and upstream about this when I get the chance.

  • SCCM 2012 - Problems running vbscript or simple command line

    Hey everybody, I'm having a heck of a time trying to get SCCM 2012 to deploy some very simple Vbscripts or even a simple command line.  I need to deploy some registry fixes across the company as well as a Vbscript that uninstalls some old applications. 
    If I run these scripts/commands outside of SCCM everything works fine, inside of SCCM it always shows "succeeded" but it doesn't actually run correct on the client.
    What's confusing to me is the use of distribution points when you're running a command line that doesn't actually have any source files.  For instance this is what I'm trying to run "regedit /s \\servername\folder\registryfix.reg".  I've also tried
    a similar bat file as well with the same result.  I've tried it with a source folder specified, I've tried it using Run Program From Server or Download locally.  I've gone through everything I can think of but can't get it to work.
    Similarly with a vbscript I'm trying "cscript.exe /s \\servername\folder\uninstallapps.wsf" and various different settings in the package deployment.
    I'm really confused here guys so any help would be greatly appreciated.  Thanks

    What I have found is that if you try and run the REG.EXE command line directly, either as a program or via a CMD/BAT file, the 64-bit redirection will occur.  So, if you had something like this in a program or via a CMD/BAT file that ran against a 64-bit
    system:
    REG ADD HKLM\Software\Microsoft\Test /v Test /d Test
    You would end up with this registry entry existing under:
    HKLM\Software\Wow6432Node\Microsoft\Test
    That's because SCCM uses the 32-bit launcher to take care of this and redirection occurs - You can see this via the "CCM32BitLauncher.log" on the client.
    To work around this problem, I have done the following:
    On a reference machine, create/export the registry entry I want into a *.reg file - An example export of "Test.reg" for the above mentioned registry entry would look something like this:
    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Test]
    "Test"="Test"
      2.  Stick our "Test.reg" file in a source share, create a package with the share as the source content, and distribute it
      3.  Create a program for the package with a command line like this: 
    REG IMPORT Test.reg
    This is obviously not as clean as having a command line with a package to distribute, but I find it works fine for me and gets around the redirection for registry entries.

  • Sudo Command in Bash Script

    So I created a simple bash script to run on login.....
    one of the commands is the following:
    sudo "something something something"....
    One thing I haven't learned in my years of Unix is how do you get a bash script to run a sudo command without having to enter a password?  I know this is trival, but just a quick 'this is how you do it' would be cool.
    Thanks ahead of time on this really dumb question.

    There's a few ways to do this.  Here's two (pick the method you like):
    Method 1: Using "askpass".
    With this you always do sudo -A command.  The -A argument tells sudo to execute a command that echos the password to stdout.  That command is something you write.  For this explaination let's call the command pw and stick it /usr/local/bin.  So it's full pathname would be /usr/local/bin/pw.
    sudo -A can get the pathname to pw a number of ways.
    1. From the sudoers file.
    Use visudo to add the following line to the sudoers file:
    Defaults:ALL    askpass=/usr/local/bin/pw
    2. Using the SUDO_ASKPASS environment variable.
    export SUDO_ASKPASS=/usr/local/bin/pw
    This might work too (assuming SUDO_ASKPASS has been previously exported):
    SUDO_ASKPASS=/usr/local/bin/pw sudo -A command
    Method 2: Have sudo read the password from stdin
    echo -n password | sudo -S command
    The -S option tells sudo to read the password from stdin so echo pipes it in (without the ending newline).
    The only relatively secure scheme of these two methods is the askpass (-A) method.  At least with that method you have a chance of encrypting/hiding your password down in the command that echoes it to stdout.  The -S method would contain your password explicitly in a script somewhere unless you make other provisions to encrypt/hide it with that technique.

  • How to create a one click apple script to run sudo rm -rf in terminal

    Hey Everyone
    I have sensitive information on my computer, quite paranoid and would love to have a one click script to run sudo rm -rf in terminal.
    I'm quite new to scripts and all that, can someone please explain how to do this as a noob?
    would love if I didn't need to enter the password to authorise the wipe.
    also is there anything more effective as sudo rm -rf?
    and can sudo rm -rf be undone? like can some traces be brought back from the drive if your like a super pro at hard drive data recovery?

    Welcome to Apple Support Communities
    That's not the way to delete everything from the hard drive, because your files can still be recoverable after running that command with special apps.
    Instead, if you want to make sure that your data cannot be recovered, start up in OS X Recovery (hold Command and R keys while your Mac is starting up), open Disk Utility and erase your OS X partition by choosing one of the security options you can use to erase your files. See > http://pondini.org/OSX/DU2.html
    A better option would be to put that sensitive data onto an encrypted external drive

  • Sudo command hangs when run as winbind user

    Hi,
    It even hangs when running:
    $ sudo
    or
    $sudo -V
    So nothing to do with my sudo config - have reverted /etc/sudoers back to default. Even control-c does not work and the process needs to be killed as root, using another session.
    The command works fine when ran as a local user. It is only when running as a winbind user that there's a problem.
    Any help on what tools can be used to find out what's happening while the command is hanging would be much appreciated. Or even better any ideas on how to stop it hanging would be even better!
    Can provide any config files if they help anyone.......
    Many Thanks,
    Richard

    *** UPDATE ***
    It seems the version of sudo (v1.8*) supplied with Solaris 11 is not compatible with Winbind users.
    Workaround:
    Compile version 1.7* to /usr/local/bin and add this to the beginning of $PATH

Maybe you are looking for