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 ?

  • 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). – a CVn Dec 16 '13 at 19:07
  • 1
    Is there perhaps a connection to securetty(5)? In other words, is the tty of the ssh session listed in /etc/securetty ? (prepend /dev/) – D McKeon Dec 16 '13 at 20:38
  • You say for example su, do you get this error for other commands? – ctrl-alt-delor Dec 16 '13 at 22:45
  • 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? – Gilles Dec 16 '13 at 23:09
  • 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 . – 4m1nh4j1 Dec 17 '13 at 8:40

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.

  • 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 . – 4m1nh4j1 Dec 17 '13 at 8:46
  • Why you login as root? and you don't need the -l. – ctrl-alt-delor Dec 17 '13 at 9:28
  • 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 Dec 17 '13 at 10:16
  • I created an ssh account with "root" as login, so I use root@host for ssh – 4m1nh4j1 Dec 17 '13 at 10:17
  • 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. – ctrl-alt-delor Jun 10 '14 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.