Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [pty]

Pseudoterminals (also spelled “pseudotty” or “PTY”) are pseudo-devices used with ttys whose emulators run in userspace. Use [tag:tty] for broad (text terminal)-related questions, and [tag:console] for terminal devices pertaining to the system console.

20
votes
1answer
2k views

What does 'script /dev/null' do?

Every time I log into a VM with root, su into a user account, and try to use screen it throws an error: Cannot open your terminal '/dev/pts/0' - please check. A Stack Overflow post said I needed to ...
1
vote
1answer
51 views

ssh - Disable pseudo-terminal allocation

ssh client option "-T" is Disable pseudo-terminal allocation. If I turn on this option, the remote sshd will not allocate a pty to run remote command. How the output of remote command transfer back ...
0
votes
1answer
136 views

Where does `/dev/pts/ptmx` come from? [duplicate]

On my Archlinux, /dev/pts is mounted by the devpts, so who created the /dev/pts/ptmx device node? What's the purpose of this node? it's the same (Major=5 Minor=2) device node same as /dev/ptmx/, but ...
1
vote
1answer
273 views

Virtual serial port between docker containers

I can create two linked virtual serial ports on a Linux system with socat, and pretend one end is a serial device, and the other one is some code that uses the device. The socat command would look ...
1
vote
0answers
190 views

PTY allocation request failed on channel 0

My remote vm server's password has expired, i cann't change password. [user@localhost ~]$ ssh root@x.x.x.x root@x.x.x.x's password: PTY allocation request failed on channel 0 WARNING: Your password ...
2
votes
1answer
67 views

Do pty devices have two input buffers?

When terminal devices are in cooked mode, bytes input into terminal is cached and processed by kernel, some bytes are used for line editting and "cosumed", making read return one line a time. But for ...
1
vote
2answers
46 views

Why application does not run from SCREEN without delay?

Suppose we need to run application in screen and keep it running when screen exits. The following command does the job, but only if "sleep 1" is appended to it. Why it does not work without "sleep 1"? ...
-2
votes
1answer
61 views

Can't open a screen on pty freshly created [closed]

I have a program that communicates through a serial protocol uart. I would like to test this protocol using simple terminal emulator running on the same computer. This program opens /dev/tty. I would ...
0
votes
1answer
26 views

Software flow control: why TX is blocked on terminal?

Why terminal cannot send data after ^S was pressed? I have always thought that ^S is used by terminal to tell tty driver that tty driver must not transmit data from application TO terminal (when it is ...
0
votes
0answers
115 views

Why does ssh allocate a tty on server side?

Basically when you run an interactive program on the server you need to use ssh -t instead of ssh. For example: This works: ssh -t user@server top. This doesn't work: ssh user@server top. Question ...
2
votes
1answer
80 views

Are all the slaves paired with the same master?

In bash in lxterminal $ tty /dev/pts/2 $ ls /dev/ptmx -l crw-rw-rw- 1 root tty 5, 2 May 26 09:38 /dev/ptmx On Ubuntu, is there only one master for all the processes, and all the slaves are paired ...
1
vote
2answers
334 views

Do the output of command `tty` and the file `/dev/tty` both refer to the controlling terminal of the current bash process?

From man tty tty - print the file name of the terminal connected to standard input $ tty /dev/pts/2 From APUE: Historically, the name of the controlling terminal in most versions of the UNIX ...
1
vote
2answers
55 views

Does the master device appear just like a standard terminal to the driver program?

From the Linux Programming Interface The key point about a pseudoterminal is that the slave device appears just like a standard terminal. All of the operations that can be applied to a terminal ...
1
vote
1answer
281 views

systemd.service : use pty so force flush of stdout?

I have a service that I want to run under systemd. It is written in perl, where by default output is line buffered if STDOUT is connected to a terminal. (Which seems similar to python) The ...
0
votes
1answer
80 views

Is it possible to use a pseudoterminal to redirect PPP’s dataflow to an application?

I want to set PPP in order to use a pseudoterminal slave (/dev/pts/N) instead of a physical serial link, handle its data flow in an application (from /dev/ptmx) and redirect that flow … somewhere ...
2
votes
0answers
118 views

Opening character device for reading in parallel by multiple processes on Linux

I would like to open a character device e.g. /dev/tty1 by multiple processes in a way that would not interfere reads between them. I noticed that if one process consumes a byte, no other process would ...
0
votes
1answer
170 views

When tmux exits (closes pty master), background processes from startup scripts die — why?

I'm having difficulty understanding an answer I received to a question I posed about tmux — specifically, re: what the pseudoterminal does with child processes when it exits. Original Question I ...
2
votes
1answer
126 views

Running a pseudoterminal inside a pseudoterminal

I'm trying to understand how the programs like screen and script control I/O. My knowledge of terminal, tty etc. comes from reading the 'tty demystified' article, and all the SE answers I could find....
0
votes
1answer
792 views

Why is the ssh utility considered a pty?

I've read here that ssh is considered a pty. Why? If I run an ssh command in my console (say, in a Debian server), where comes the "pty" aspect of ssh here? For me, it's like I'm using any other ...
4
votes
1answer
241 views

BSD-style pseudoterminals vs. UNIX 98 pseudoterminals

Based on what I have read about pseudoterminals in Linux, there are two types of pseudoterminals: BSD-style pseudoterminals (which is deprecated) and UNIX 98 pseudoterminals. I have created two ...
0
votes
1answer
118 views

Find unused pseudoterminal pair in systemd service?

Application for which I'm writing service file expects its STDIN to be connected to the tty, or in other words to be run on the terminal. Systemd has the following settings which do the trick for my ...
2
votes
0answers
468 views

Setting up Linux Bluetooth 4.0 serial port - gatttool/socat?

Bluetooth LE/ 4 is different from traditional Bluetooth serial port profiles and old instructions don't work. Bluetooth LE is basically all user mode, and there are some instructions on accessing LE ...
2
votes
1answer
3k views

socat - UART logging and redirecting

I am currently trying to log all communication from and to /dev/ttyUSB0 and simultaneously be able to connect minicom/screen to the same device for interaction. I tried a couple of tools and ...
2
votes
1answer
284 views

Why changing tty settings on one file descriptor affects another?

ECHO setting is enabled on stdin and stdout by default. But why if we disable ECHO on stdin, it is also disabled on stdout? They have two separate descriptors - 0 and 1, so why they are changed ...
12
votes
1answer
635 views

Why are two ^D presses necessary to exit `cat`? [duplicate]

Let's run cat and then type a then ^D - you will see that cat did not exit. Compare it with cat + a + Enter + ^D - now cat did exit. So, why two ^D presses are necessary to exit cat in the first ...
4
votes
1answer
357 views

Does the process on the slave side of a pty talks to the line discipline or to the slave tty driver?

I have found two contradictory images of how a pseudo terminal (pty) works. The first image shows that the process on the slave side of a pty talks to the line discipline: The second image shows ...
1
vote
2answers
286 views

Why does Fedora have two `ptmx` files?

I know that the file /dev/ptmx is used to generate a master file for a pseudo-terminal. But I have found out that Fedora has another ptmx file (/dev/pts/ptmx): What is the purpose of this second file?...
2
votes
3answers
278 views

Does a virtual terminal have a master end?

When I open a terminal emulator (xterm for example), xterm will have a master end (/dev/ptmx), and a slave end (/dev/pts/#). But what about when I open a virtual terminal (by pressing Ctrl+Alt+F#), ...
2
votes
0answers
570 views

Socat open TCP only when PTY opened

I am trying to link a virtual PTY with a remote device which accepts TCP connections on port 23. The opening and closing of the socket on the target device is a significant event and part of the ...
5
votes
1answer
283 views

How does the Terminal and the Shell exchange data?

In Linux, a Terminal is associated with a Shell. The Terminal send input to the Shell (for example: pwd), and the Shell send the output back to the Terminal (for example: /home/paul). This diagram ...
0
votes
2answers
631 views

/dev/pts/* group writable in permissions but not in reality

Whenether I execute the command ls -lh on /dev/pts I get: crw--w---- 1 usr1 tty 136, 0 Mar 16 16:41 0 Which does seem to allow users that belong to the same group as usr1 to write that into that. ...
6
votes
3answers
7k views

What is the difference between **pts** and **tty** and **:0**?

Please help me to distinguish pts from gui mode generated from tty. booting to multi-user.target I did this: sudo systemctl set-default multi-user.target reboot login with regular user ...
2
votes
1answer
967 views

Is there a way to reptyr a make process or any process with subprocesses?

Consider the following Makefile. all: yes If I run make and suspend using Ctrl-Z, and then start screen or tmux, followed by an attempt to reptyr, I get the following error. $ reptyr 5328 [-] ...
1
vote
1answer
4k views

How to disable requiretty on ubuntu 16.04 [closed]

I"m using packer to create automated linux golden images. When I try and run a script that requires sudo, I get the following error sudo: no tty present and no askpass program specified This error ...
2
votes
1answer
554 views

Pseudo-terminals vs. a pair of pipes

Why are pseudo-terminals a seperate feature on Unix-like systems? What makes them superior to a pair of pipes or FIFOs for implementing terminal emulators?
4
votes
1answer
764 views

Is it possible to reuse the slave end of a PTY after closing it?

After the slave end is used (open(), read(), write(), close()), the master's read() finishes and returns with an EIO error. But I was expecting to be able to open()/close() multiple times the slave ...
0
votes
2answers
154 views

How to get the opened pty for a given background process (without login) in AIX

Using this answer https://unix.stackexchange.com/a/283521/114939 which allow us to find processes that keep an given pty opened without login (who command cannot show them), caused me to ask the ...
2
votes
1answer
347 views

Why are some pts in AIX never reused?

In an AIX system (AIX p740 1 7) that is running for about several months, some pts aren't reused anymore. This was noticed using the "who" command, with the following "awk" expression, running it ...
11
votes
3answers
3k views

Why doesn't sshd use a pseudo terminal when the ssh client's argument is followed by an interactive program?

The normal way to connect to an SSH server is ssh username@ip_address. But a user may only want to run a program on the remote machine. So the program name follows after the normal argument which is ...
4
votes
2answers
816 views

Terminal allocation breaks files while using ssh for transfer

I used ssh to untar a remote file using: ssh host "cat file.tgz" | tar xf - This works perfectly fine. However I noticed while playing with forced commands, that pty-allocation changes the output of ...
0
votes
1answer
158 views

openpty returning zero as master file descriptor

I am opening a pseudoterminal with openpty function. This will be used to redirect some data coming from a serial port into an external application (in this case, a GPS receiver). The fact is that ...
18
votes
2answers
16k views

How to run builds in Docker containers from Jenkins

I am trying to use Jenkins to build a C++ project in a Docker container. I have no problem building in Jenkins, or building in a container outside of Jenkins. Below is what I tried. I am omitting the ...
33
votes
6answers
6k views

How to trick a command into thinking its output is going to a terminal

Given a command that changes its behaviour when its output is going to a terminal (e.g. produce coloured output), how can that output be redirected in a pipeline while preserving the changed behaviour?...
3
votes
2answers
904 views

Bash shell launched by forkpty() spawns child processes that ignore SIGINT. Why and how do I ensure SIGINT is not ignored?

I have a C program that uses forkpty to execute a bash shell. I'm finding that the programs launched by this shell are launched with SIGINT ignored, so when I send a Ctrl-C to the shell they never ...
4
votes
1answer
704 views

“No more PTYs” when starting screen as non root-user

Whenever I try to start a screen-session as a non-root-user I get "No more PTYs." as a response. Same command in the same directory as root works properly. I tried the solution from this post but it ...
1
vote
1answer
83 views

Using shared serial modem

I'm trying to use on Solaris box modem connected to Linux box via serial port. Sharing is made from socat. Server command(linux): socat tcp-l:54321,reuseaddr,fork file:/dev/ttyXXX0,nonblock,...
2
votes
2answers
338 views

Wrapper to allocate a pty (opposite to nohup)

I have a command foo that (for reasons we need not go into) needs to have a pty allocated, i.e. foo succeeds but nohup foo fails. What is the easiest way to allocate a pty when there is not one? ...
1
vote
4answers
161 views

Different behavior of tty's vs pty's

If I do man bash inside of X, e.g., in xterm or mate-terminal, I get some words underlined. If I do man bash in a virtual terminal, I get those same words colored. Can I get the same coloring in X? ...
4
votes
1answer
1k views

Mocking a pseudo tty (pts)

We would like to run some curses based apps in background. These apps use curses and get the current tty port name to be used internally to map log files and others context-terminal associations. ...
4
votes
1answer
2k views

How can I fix /dev/pts after mounting it?

I made the same mistake as in this question: Debian chroot blocking PTTYs on host I mounted a "devpts" filesystem inside a chroot, and now urxvt can't create ptys. Oddly enough xterm still can. ...