Results 1 to 8 of 8

Thread: SCP not working - gives "stdin: is not a tty"

Hybrid View

  1. #1
    Join Date
    Mar 2006
    Location
    Michigan, US
    Beans
    82
    Distro
    Ubuntu

    SCP not working - gives "stdin: is not a tty"

    I have googled this for a while and found inconclusive answers. The general consensus is that if it works, who cares. . .

    This 'used' to work for me even with this message. But now it does not function.

    My syntax is simply

    scp filename root@server.com:/home/user/

    and then I get the error

    stdin: is not a tty

    and nothing is copied.

    Please help if you can.

  2. #2
    Join Date
    May 2008
    Location
    Eugene, OR, USA
    Beans
    435

    Re: SCP not working - gives "stdin: is not a tty"

    I've seen this error when your ~/.profile or ~/.bashrc on the remote machine ("server.com" in your example) has a stty statement in it. stty should only be used on interactive shells, and your scp session doesn't qualify.

    The usual work-around is to prefix the stty statement with a conditional so that the stty is only executed in an interactive shell. A typical idiom is:

    Code:
    [ "$PS1" ] && stty intr '^C' kill '^U' erase '^H' echoe
    The stty command will only run if the first part of the expression above evaluates to true. The environment variable $PS1 is only set if this is an interactive shell.
    Hal Pomeranz, Deer Run Associates
    [[ Various Linux/Unix related documents ]]
    [[ Command-Line Kung Fu blog ]]

  3. #3
    Join Date
    Mar 2006
    Location
    Michigan, US
    Beans
    82
    Distro
    Ubuntu

    Re: SCP not working - gives "stdin: is not a tty"

    I had read this on the internet . . . I checked earlier both .bashrc and .bash_profile (and also /etc/bashrc and /etc/profile) and none of them have stty in them.

    I am (for the hell of it) grepping the whole of both machines for the pattern stty - although I doubt this will help. Any further suggestions from anyone?

    Thanks

  4. #4
    Join Date
    Aug 2006
    Beans
    841

    Re: SCP not working - gives "stdin: is not a tty"

    maybe instead of allowing root to ssh, use a regular user

    if you are trying to copy something inside the user's home do
    Code:
    scp filename user@server.com:path/inside/home_dir
    it will copy to
    Code:
    /home/user/path/inside/home_dir/

  5. #5
    Join Date
    May 2008
    Location
    Eugene, OR, USA
    Beans
    435

    Re: SCP not working - gives "stdin: is not a tty"

    Quote Originally Posted by becatlibra View Post
    I had read this on the internet . . . I checked earlier both .bashrc and .bash_profile (and also /etc/bashrc and /etc/profile) and none of them have stty in them.

    I am (for the hell of it) grepping the whole of both machines for the pattern stty - although I doubt this will help. Any further suggestions from anyone?
    It could be another interactive command besides stty that's trying to execute from one of your start-up files and display output, etc. You might try temporarily moving your start-up files on "server.com" out of the way and then doing the scp. If the error goes away, you'll know that there's some issue with one of the start-up files. Then add them back one-by-one until the error re-appears and you'll be able to narrow down the file that's causing the problem.
    Hal Pomeranz, Deer Run Associates
    [[ Various Linux/Unix related documents ]]
    [[ Command-Line Kung Fu blog ]]

  6. #6
    Join Date
    Dec 2007
    Location
    Austin, Texas USA
    Beans
    259
    Distro
    Ubuntu

    Re: SCP not working - gives "stdin: is not a tty"

    I have this same problem and I think it is some sort of faulty installation of Ubuntu.
    I have done all the updates etc, to no avail!

    This is xen machine with problem, when I ssh to it as root I get the tty error and I have to close the terminal (I am using GUI) it freezes no ctl c out of.
    When I go into the faulty machine and ssh to my workstation, I get a different error:

    Code:
    PRNG is not seeded
    I dont know what PRNG is?
    Any ideas?

  7. #7
    Join Date
    Dec 2007
    Location
    Austin, Texas USA
    Beans
    259
    Distro
    Ubuntu

    Re: SCP not working - gives "stdin: is not a tty"

    PARTIALLY SOLVED!

    I got some ideas by looking here;
    http://lists.xensource.com/archives/.../msg00285.html

    I used MAKEDEV under /dev to manually make those tty#s which did not exist? (why they weren't there? I dont know?) MAKEDEV tty1 or 0 or 2 whatever...
    then I ran
    apt-get install udev
    that updated all my c/cpp libs.
    also as they suggested I put those 2 lines in my startup which the 2nd one was already there so I got a warning msg.
    update-rc.d -f udev start 03 S

    Now I can ssh to it no problems and I am sure you can scp as well.
    I am still having this error though at the boot up:
    Couldnt get a file descriptor referring to the console
    Couldnt get a file descriptor referring to the console
    Couldnt get a file descriptor referring to the console
    Couldnt get a file descriptor referring to the console

    this goes on until I break out of it?!

Bookmarks

Posting Permissions

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