“Must be connected to a terminal error” with screen -x command on a Linux Container

99封情书 提交于 2019-12-21 06:23:39

问题


I am using Linux containers with Proxmox 4. When I am connected on an Ubuntu 16.04 container with:

pct enter <id>

I run a script with screen and try to watch the process running with:

screen -x <processname>

I got the error:

Must be connected to a terminal error

When I connect with:

ssh -t <user>@<container_ip>

It works, I can attach the display to the screen.

How can I use screen -x when I am connected with pct enter ?


回答1:


I found a solution that works for same case(https://www.svennd.be/screen-in-lxc-attach)

Execute this

script /dev/null

Then you can run screen, et voila




回答2:


This is happening mostly because of the reason that you must have switched user to the current terminal user using the command sudo su or user changing command. You will need to own the shell on which you are working. You can do so by running this: script /dev/null.

Alternatively, You can restart the terminal session with the user(which was used when creating screen) and not coming to current user using switch user commands.

To know active screens : screen -list



来源:https://stackoverflow.com/questions/39471261/must-be-connected-to-a-terminal-error-with-screen-x-command-on-a-linux-contai

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!