Operating System - HP-UX
1753808 Members
7746 Online
108805 Solutions
New Discussion юеВ

Re: .Xdefaults setup question

 
SOLVED
Go to solution
Aldis Black
Advisor

.Xdefaults setup question

Hi,

When I am accessing the root account via su (using CDE) the dynamic terminal resize is not working. I guess it has something to do with the .Xdefaults file i created for my user account (which I am executing the su from) so the .profile could be executed under CDE. The problem does not occure when accessing the root directly so I assume it must be a matter of some variables set for the user account. Please advise! Thanks!
3 REPLIES 3
Matti_Kurkela
Honored Contributor
Solution

Re: .Xdefaults setup question

The dynamic terminal resize happens when the terminal emulator (e.g. dtterm) or the remote access daemon (telnetd/rlogind/sshd) sends a SIGWINCH (WINdow CHange) signal to the program running on the pty.

The problem is, a regular user can send signals to his own processes only, not to processes owned by someone else.

When you access the root account via su, it starts another shell that will be owned by root, and thus it will be immune to SIGWINCH signals coming from the original session.

So the problem is *not* caused by any variables or .Xdefaults settings: it is a consequence of how signals work on any POSIX-compliant Unix system.

As a workaround, when accessing the root account, you can trigger the resize manually by running:

eval `resize`

(With some situations, even just "resize" can work... but with the eval and backticks, it will ensure the LINES and COLUMNS environment variables will be set to the new values.)

MK
MK
Aldis Black
Advisor

Re: .Xdefaults setup question

OK, but how can the resize command be effective in such case? It has to read the curent window (owned by user) settings and fit the terminal size to it (owned by root)?
Thanks!
Matti_Kurkela
Honored Contributor

Re: .Xdefaults setup question

I could simply remind you that "root can read and write *anything*", but that would not explain why su can be used to switch from one unprivileged user to another unprivileged user, too.

The SIGWINCH signal only informs processes that the terminal size has changed; it does not carry any information about the new size. The program that receives the signal must find out the new size on its own, if it wants to act on the signal.

Only the signal is blocked by the su operation; any process that can do terminal I/O can also inquire the size of the terminal window it's running on, whether it's running within a su session or not.

MK
MK