Command : must be run from a terminal

18,223

Try the -t option to ssh. If that does not work try -tt.

-t Force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.

Share:
18,223

Related videos on Youtube

4m1nh4j1
Author by

4m1nh4j1

This is not a bio.

Updated on September 18, 2022

Comments

  • 4m1nh4j1
    4m1nh4j1 over 1 year

    I have a shared hosting account, I logged using ssh. when I type for example su I had this output : su: must be run from a terminal

    Is this error relative to the fact that I don't have sufficient permissions or to something else ?

    • user
      user over 10 years
      Normally I'd expect that error to be an indication of there being no TTY allocated for the connection, but that doesn't make a lot of sense if you are connecting through SSH and getting a shell. Can you share the exact steps you take to get that error, starting with a ssh -F /dev/null user@host from your local system? (The -F /dev/null causes any system or user local SSH configuration to be ignored.) If you aren't authorized to use su, that will normally cause a much more obvious error message (though I don't recall the exact wording, and don't have a system set up where I can try it).
    • D McKeon
      D McKeon over 10 years
      Is there perhaps a connection to securetty(5)? In other words, is the tty of the ssh session listed in /etc/securetty ? (prepend /dev/)
    • ctrl-alt-delor
      ctrl-alt-delor over 10 years
      You say for example su, do you get this error for other commands?
    • Gilles 'SO- stop being evil'
      Gilles 'SO- stop being evil' over 10 years
      What does the command tty show? Are you logging in with ssh then typing su, or are you running ssh su? What terminal emulator are you using? Are you supposed to have root access?
    • 4m1nh4j1
      4m1nh4j1 over 10 years
      Trying to answer all questions : I log in with ssh (ssh -l login@host host I can log in, only when using this command) than type su (other commands works normally), when I type tty I have : not a tty .
    • ctrl-alt-delor
      ctrl-alt-delor almost 10 years
      Are you still struggling with this? Can you give more detail about what you are doing? What are you logging into and from where?
  • 4m1nh4j1
    4m1nh4j1 over 10 years
    I tried ssh -tl root@host host and with double t, but had the same result. Ps: as it is mentioned in the documentation, to login with ssh I should use a command like this ssh -l login@host host .
  • ctrl-alt-delor
    ctrl-alt-delor over 10 years
    Why you login as root? and you don't need the -l.
  • 4m1nh4j1
    4m1nh4j1 over 10 years
    I am using -l because I found that without adding it, I can't login . I can see this in the documentation dtcsupport.gplhost.com/UserDoc/FRHow-Works-clientSSH-System (The only page that I have found is in french) . If I don't use -l ssh don't accept my password.
  • 4m1nh4j1
    4m1nh4j1 over 10 years
    I created an ssh account with "root" as login, so I use root@host for ssh
  • ctrl-alt-delor
    ctrl-alt-delor almost 10 years
    Login as root, considered harmful: Most people concerned with security disable root login. You can gain root privileges once you are logged in (I recommend sudo). If you also disable password authentication, thus forcing key based authentication, then you will need the key and password to get to root.