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.
Related videos on Youtube
Comments
-
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 over 10 yearsNormally 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 usesu
, 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 over 10 yearsIs 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 over 10 yearsYou say for example
su
, do you get this error for other commands? -
Gilles 'SO- stop being evil' over 10 yearsWhat does the command
tty
show? Are you logging in with ssh then typingsu
, or are you runningssh su
? What terminal emulator are you using? Are you supposed to have root access? -
4m1nh4j1 over 10 yearsTrying to answer all questions : I log in with ssh (
ssh -l login@host host
I can log in, only when using this command) than typesu
(other commands works normally), when I typetty
I have :not a tty
. -
ctrl-alt-delor almost 10 yearsAre you still struggling with this? Can you give more detail about what you are doing? What are you logging into and from where?
-
-
4m1nh4j1 over 10 yearsI 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 thisssh -l login@host host
. -
ctrl-alt-delor over 10 yearsWhy you login as root? and you don't need the
-l
. -
4m1nh4j1 over 10 yearsI 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 over 10 yearsI created an ssh account with "
root
" as login, so I useroot@host
for ssh -
ctrl-alt-delor almost 10 yearsLogin 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.