I am working on a asus router running asusware. Its a embedded linux implementation and more and less are busybox implementations. When I log into the router as admin (root) using telnet then more and less paging works perfectly (eg. stop scrolling at end of page at 24 lines). However when I log in with a account that lacks root privileges scrolling does not stop until end of file no matter how large the file. I have verified that my environment variables (TERM=xterm,LINES=24,COLUMNS=80) are set and OK. Also vi works correctly when editing files, I can move the cursor around normally. So terminal control in general seems to work. I also checked that normal users have full permissions to share/terminfo files.

By my logic it appears to be some kind of permission issue since immediately if I move the user group assignment to group root (0) in /etc/passwd scrolling starts to work as expected. But when moved to group 500 (users on this system) it stops working. But it makes no sense to me.

So the question is where to look next. What other files are involved in controlling these things?

  • What is the ownership and permissions on /dev/tty ? – David G. Dec 8 '20 at 12:17
  • crw-rw---- 1 admin root 5, 0 Jan 1 1970 tty. Thank you. That was it. adding rw for others fixed the problem. Weird that permissions were like that from the start. Could it be that the vendor somehow wanted to be restrictive from at security point of view? But that does not make any sense to me. – Otto Keronen Dec 8 '20 at 13:13

What is the ownership and permissions on /dev/tty ?

Some tools might re-open /dev/tty instead of using an existing file descriptor to check what the terminal size is. In busybox, this might have been from extreme code size reduction.

Some distributions might protect /dev/tty more than they should. I suspect this might just be careless setup, protecting /dev/tty*

In this case, OP reported:

crw-rw---- 1 admin root 5, 0 Jan 1 1970 tty

which turned out to be the issue.

It is worth noting that, depending on the filesystems, this might need to be reset every time the device is rebooted. This might be done in /etc/mdev.conf, /etc/udev/rules.d/, /etc/rc.local, or somewhere else dependent on your distribution. Or it might have to be done remotely if there is no persistent modifiable storage.

(Answer added for the check.)

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.