Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #354931
    Anonymous
    Participant

    I have run into a situation where I need to write commands to the command line and they need to be executed by root. Now, I know I can do something like

    echo rootpassword | sudo -S mycommands

    but the problem is that the user this would be issued from would not be in the /private/etc/sudoers file and I dont want to have to append it with the user I am issuing it from. So, since the user I am using is NOT in this file I tried something like

    echo rootpassword | su -l root; MyOtherCommands

    but I need to know the proper syntax to trick the su password to read from where the echo is being written to. Its kinda confusing but thought someone here would know the answer to this one.

    #354933
    Anonymous
    Participant

    Scripts are not an option. It will definitely need to be done this way. Direct with out a script issuing the commands.

    #355028
    Anonymous
    Participant

    Its been a while and figured maybe someone may have thought of something. Yes, no maybe???

    #355049
    Anonymous
    Participant

    use ‘expect’

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Comments are closed