Find the answer to your Linux question:
Results 1 to 3 of 3
Hi I'm trying to use automatic login with sudo like this: echo "<mypassword>\n" | sudo -S su - <myuser> or cat pass.txt | sudo -S su - <myuser> but in ...
  1. #1
    Just Joined!
    Join Date
    Apr 2011
    Posts
    1

    sudo -S not working

    Hi I'm trying to use automatic login with sudo like this:

    echo "<mypassword>\n" | sudo -S su - <myuser> or
    cat pass.txt | sudo -S su - <myuser>

    but in both case I'm getting the same error:

    stty: standard input: Invalid argument
    ksh: <stdin>[1]: <mypassword>: not found


    my linux version:
    $ uname -a
    Linux <host> 2.6.9-89.33.1.EL #1 Mon Nov 15 18:52:05 EST 2010 x86_64 x86_64 x86_64 GNU/Linux

    my sudo version:
    $ sudo -V
    Sudo version 1.6.7p5

    my terminal settings
    $ stty -a
    speed 38400 baud; rows 42; columns 145; line = 0;
    intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
    lnext = ^V; flush = ^O; min = 1; time = 0;
    -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
    -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel
    opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
    isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke



    Someone could help me with that ?
    i'll really appreciate


    Tks,
    Fabrizio

  2. #2
    Linux Enthusiast meton_magis's Avatar
    Join Date
    Oct 2006
    Location
    arizona
    Posts
    665
    I'm not quite understanding how you're trying to login.

    You are trying to auto-login on a tty login prompt??
    I don't think that is possible.

    If you are trying to auto-login to an X windows session, I know gnome has a method for that.

    If you want to auto login from 1 user to another via script, both sudo and su require stdin to be a tty.
    New to the internet, technical forums, or the hacker / open source community??
    Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html

    RHCE for RHEL version 5
    RHCT for RHEL version 4

  3. #3
    ved
    ved is offline
    Linux User ved's Avatar
    Join Date
    Jan 2008
    Location
    New Delhi
    Posts
    309
    Read this link it help you
    Personal Fedora 13 Installation Guide
    Take risks: if you win, you will be happy; if you lose, you will be wise.
    New Users : Read This First

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...