Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Switching between X and console windows (ALT-Fx)
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
dreamer3
Guru
Guru


Joined: 24 Sep 2002
Posts: 553

PostPosted: Thu Oct 03, 2002 1:42 pm    Post subject: Switching between X and console windows (ALT-Fx) Reply with quote

When I hit ALT-Fx to take me to a different console window and then hit ALT-F1 (the console I'm running X in) to take me back I find myself simply looking at the console output of X and the only thing I can do is kill X (CTRL-C) and restart it.

HOWEVER, I remember at one point I could switch seamlessly and my graphics would come back when i ALT-Fx-ed back into my X console.

Any thoughts?
Back to top
View user's profile Send private message
dreamer3
Guru
Guru


Joined: 24 Sep 2002
Posts: 553

PostPosted: Thu Oct 03, 2002 1:49 pm    Post subject: Reply with quote

Nevermind, hitting ALT-F7 takes me back to X, but that leaves with with another question... how can I setup X to allow simultaneous logins from multiple users on multiple consoles (I know we all can't use the same monitor, but I'm tired of logging out of X so my friend can login). Windows XP has what it calls "fast user switching" to accomplish this.

Any ideas?

EDIT: Ok, I sort of have this working... If I type X :1 to start X from the second account it starts in "console 8' (ALT-F8). And I can switch back and forth (very cool). Now, can I set it up so when I'm running a LOCKED X Window session somone can't just Alt-F1 to the console and kill it and do who knows what with my account?

Also if someone can give me some idea how to automatically setup the accounts to run in different windows I would appreciate it. Thanks.

EDIT 2: Do any of the login managers do this sort of thing automatically (though I'd hate my comp to start automatically to X)
Back to top
View user's profile Send private message
dreamer3
Guru
Guru


Joined: 24 Sep 2002
Posts: 553

PostPosted: Thu Oct 03, 2002 2:08 pm    Post subject: Reply with quote

Ok, I added exec X :1 to my second users .xserverrc file and X comes up in a diff "window" but none of the programs load. I see this error a BUNCH of times though after killing X:

Xlib: connection to":0.0" refused by server
Xlib: invalid MIT-MAGIC-COOKIE-1 key


Maybe they are trying to connect to the orginal X session???
Back to top
View user's profile Send private message
dreamer3
Guru
Guru


Joined: 24 Sep 2002
Posts: 553

PostPosted: Thu Oct 03, 2002 6:03 pm    Post subject: Reply with quote

After some dinking around... it works PERFECTLY if I start X from account #2 with startx -- :1. I had KDE running with one user and my other Fluxbox desktop running and I could switch back and forth with no problems.

Now which config files do I need to change to make this seemless? I would have thought that .xserverrc would do the trick...
Back to top
View user's profile Send private message
dreamer3
Guru
Guru


Joined: 24 Sep 2002
Posts: 553

PostPosted: Thu Oct 03, 2002 7:27 pm    Post subject: Reply with quote

I added the following code to startx right before the authorization section:
Code:
# check to see if an XServer is already running on display 0
# if so, start this on display 1

runningx=`ps -Af | grep "X :0"`
if [ x"$runningx" != x ]; then
   display=":1"
fi

This has the desired effect of allowing two different users to login on different consoles without bothering each other.

My question still stands about security related to a user switching to the console of a locked X session and killing the session with CTRL-C or CTRL-Z, etc.
Back to top
View user's profile Send private message
grakker
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2002
Posts: 100

PostPosted: Thu Oct 03, 2002 7:47 pm    Post subject: Reply with quote

It was fun reading this one sided conversation.
Back to top
View user's profile Send private message
Curious
Bodhisattva
Bodhisattva


Joined: 13 May 2002
Posts: 395
Location: Sydney, Australia

PostPosted: Thu Oct 03, 2002 8:16 pm    Post subject: Reply with quote

dreamer3 wrote:
Now, can I set it up so when I'm running a LOCKED X Window session somone can't just Alt-F1 to the console and kill it and do who knows what with my account?


Well yes, you could do it the correct way, and never leave an unattended shell lying around. Today you will learn a little about process control.

Code:
$ startx &
$ exit


Thats one way. Start X in the background ("&"), which will leave your shell still interactive. Then hit ctrl-d or type exit to log out, or the following ( functionally equivalent ):

Code:
$ startx
CTRL-Z
$ bg
$ exit


Ctrl-Z suspends a process. You can use the bg command to make a suspended process resume, in the background, or fg to make it resume, in the foreground.

Or, you could run X out of a Display Manager like KDM / XDM / GDM, and save all this hassle to start with. Your call.

-- Curious
_________________
Are you down with the Hawk?
Back to top
View user's profile Send private message
dreamer3
Guru
Guru


Joined: 24 Sep 2002
Posts: 553

PostPosted: Thu Oct 03, 2002 8:50 pm    Post subject: Reply with quote

Yes. I understand. Only problem is that typing startx immediately takes me to graphical mode and away from the console (so I'd need to switch back to the console to logoff).

I wrote a BASH script that starts X in the background, finds the PID of the login bash process and then kills the process (which seems quite effective to log me off the console).

Seems to work fine though I'd be open to hearing about a better way (that sill lets me boot to a console, not window manager).
Back to top
View user's profile Send private message
OdinsDream
Veteran
Veteran


Joined: 01 Jun 2002
Posts: 1057

PostPosted: Thu Oct 03, 2002 11:03 pm    Post subject: Reply with quote

Whenever I boot my machine, I don't have kdm start automatically. I usually log in as root, and then issue:

kdm && exit

...which starts up X with the KDE login screen, and automatically logs out root on the console. If anyone were to switch to another console with CTRL+ALT+FX, they would need to log in first (as root...) in order to be able to kill my current KDE desktop session.

CTRL+ALT+Backspace can also be deactivated, although I haven't done this.
Back to top
View user's profile Send private message
Curious
Bodhisattva
Bodhisattva


Joined: 13 May 2002
Posts: 395
Location: Sydney, Australia

PostPosted: Thu Oct 03, 2002 11:05 pm    Post subject: Reply with quote

OdinsDream wrote:
kdm && exit


That works? I thought "&&" meant 'Wait for the first program to terminate, and if it exited successfully, then run the second program.'

Or does KDM fork and immediately exit with error code 0?

-- Curious
_________________
Are you down with the Hawk?
Back to top
View user's profile Send private message
Curious
Bodhisattva
Bodhisattva


Joined: 13 May 2002
Posts: 395
Location: Sydney, Australia

PostPosted: Thu Oct 03, 2002 11:07 pm    Post subject: Reply with quote

dreamer3 wrote:
Yes. I understand.


Sorry for jumping on you, I hadn't had my morning caffeine / techno. ;-)

dreamer3 wrote:
I wrote a BASH script that starts X in the background, finds the PID of the login bash process and then kills the process (which seems quite effective to log me off the console).


Thats pretty phat. Does "startx & exit" work for you? I just tested it on the office webserver....

-- Curious
_________________
Are you down with the Hawk?
Back to top
View user's profile Send private message
dreamer3
Guru
Guru


Joined: 24 Sep 2002
Posts: 553

PostPosted: Thu Oct 03, 2002 11:33 pm    Post subject: Reply with quote

Maybe, I'll try it next time I restart X and see.
Back to top
View user's profile Send private message
nemhain
Tux's lil' helper
Tux's lil' helper


Joined: 26 Apr 2002
Posts: 97
Location: Sundsvall, Sweden

PostPosted: Thu Oct 03, 2002 11:46 pm    Post subject: Reply with quote

If you run GDM you could try running "gdmflexiserver" from within your X session. It seems to be like the user switching in XP. Haven't looked at it much though.
Back to top
View user's profile Send private message
OdinsDream
Veteran
Veteran


Joined: 01 Jun 2002
Posts: 1057

PostPosted: Fri Oct 04, 2002 12:24 am    Post subject: Reply with quote

Curious wrote:
OdinsDream wrote:
kdm && exit


That works? I thought "&&" meant 'Wait for the first program to terminate, and if it exited successfully, then run the second program.'

Or does KDM fork and immediately exit with error code 0?

-- Curious


I'm not sure of the technical aspects of this, but it does clearly work. Maybe your machine is faster than mine, but after I type in kdm && exit I can see the console exiting, and waiting for a new login just before X takes over. I can also verify this with CTRL+ALT+F1 after KDM is up and running.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum