bash# "chvt N" as non-root says 'Operation not permitted'
Hiya folks :)
OK, the basic details first: I have a video card with THREE connectors (DVI, VGA, S-VIDEO), but it will only run any TWO displays at a time.
My main X configuration uses two monitors (DVI & VGA), but I wanted an alternate X configuration I could switch to easily, with output to DVI + SVIDEO, so I could watch movies on the television sometimes.
Rather than do a lot of messing around with multiple xorg.confs, logging-out/in again, or unplugging things, I made two 'ServerLayouts' in my xorg.conf;
Now, by clicking a desktop-link to a one line script like so:
startx -- :1 -layout "television"
A second X session starts using the "television" ServerLayout and displays video on my main monitor, plus the TV. The second monitor turns off. I switch back using CTRL-ALT-F7.
This is cool, and works from my user desktop, but here's the issue(s):
A) Regardless of whether I use a :1 or :2 or :6 or :<any-number> in the command above, the new session starts on CTRL-ALT-F2 (which is technically TTY2 I guess). What do I have to do to get the new session to start on CTRL-ALT-F6 for example? I'd prefer using F7 & F6 than F7 & F2. Just makes better sense to me.
B) More importantly, I have learned that if I want a similarly clickable (bash) method of switching back to CTRL-ALT-F7 (my default X session) it seems I need to use the chvt N command. However, as a regular user, chvt 7 returns a 'Operation Not Permitted' error. As root, it works fine, but I'm not running as root.
The binary chvt is rwx r-x r-x so I should be able to execute it.
I'm sure there is a VERY simple item I am overlooking, but keep coming back to such things as inittab, init, .bashrc, .bash_profile, and similar files, but it doesn't look like the answer lies in one of these files.
Google mostly gives me the same bash and X tutorials paraphrased 100 different ways, but all they focus on are CTRL-ALT-Fn (not a mouse click) and chvt N (works in the tutorials, but not for me).
Guidance is appreciated :)
Interesting; thank you Osor for the quick and concise reply.
So, kinda funny how I can start an X on another terminal, but then can't use chvn just the same to switch back to my default session.. Well, perhaps I will have to settle on using the CTRL-ALT-F7 method, or right click desktop and switch to my other logon. No big deal. (Note: I don't use SUDO for anything.)
As to the first issue, I was indeed aware that the "DEFAULT" is to open the new session on the first available console, BUT, is there no way to specify an alternate?
Thanks again :)
Solved - chvt an unnecessary luxury; X session #2 starts on TTY6
Well, here's the situation currently:
I can use the chvt command to change to whatever console I want, ONLY IF I set the SUID bit on chvt.
Despite that I feel chvt is a relatively benign binary, and this is a fairly well hardened desktop system with no (known) remote access or other users, I'd just as soon NOT use SUID for anything not really necessary. This issue isn't that big a deal. I can get by by either logging out of my second X session after the movie, or hitting CTRL-ALT-Fn to switch.
However, I did figure out a way to get my second X session to start up on TTY6 :) , by changing the following section of my inittab file like so:
Thanks for the input Osor; I think I will be content with this setup.
P.S. - I also had tried earlier to make sure I had RW permissions to the TTYs. All VC/TTYs are in the group TTY, to which I added my user account, and the permissions of the TTYs were RW-RW---- so should be sufficient, but still, chvt wouldn't let me switch to one.
|All times are GMT -5. The time now is 10:36 PM.|