login and non-login shell question
Hello this is just a simple question When you are at a graphical login to log into a Window manager, Is it considered a login shell or a non-login shell?
Thanks. |
It'll be a login shell; i.e., the content of /etc/profile (and anything it includes, such as /etc/login.defs) will be executed as will your .profile, .bashrc, .whatever.
Where you might experience non-login shells is when you open a terminal window (where you just get a $ as a prompt). That behavior can be altered in your window manager preferences or in the preferences for the terminal program -- in Xfce (and probably others) you can check a box to "run command as login shell" (which executes all the above as if you logged in). Usually, if you open a terminal and execute Code:
ps -f Code:
UID PID PPID C STIME TTY TIME CMD Hope this helps some. |
Yes i found your information helpful. As a matter of fact i am on the chapter regurding shells lol.
So what your saying is that even though it is a GUI login screen the login shell is running in the background correct? Thanks |
Quote:
Shell programs -- BASH, Bourne, C, Korn (and others) -- are command interpreters; they're the interface between you on a console or terminal emulator (like an X Terminal) and the operating system. They're not running until you log in. You type a command at a shell program prompt and the shell "forks and exec's" that program. You can create shell programs that perform useful work incorporating such concepts as if-else if-else, for, while and other constructs -- a shell program is a programming language like any other. Logging in is a different concept and not necessarily related to any of the shells. There are three programs, init, getty and login, used for that purpose. The init program "is the parent of all processes. Its primary role is to create processes from a script stored in the file /etc/inittab. This file usually has entries which cause init to spawn gettys on each line that users can log in. It also controls autonomous processes required by any particular system." (from the manual page). In /etc/inittab, there is a default run level defined. On my system it is run level 3 which stops at a full-screen console (no GUI). On your system, it will probably be run level 4 (possibly some other run level but not 0, 1, or 6 which are 0 = halt the system and shut off the power, 1 = single user mode, 6 = reboot). The entry in /etc/inittab will look something like this: Code:
# Default runlevel. (Do not set to 0 or 6) The gdm program, I'm pretty sure, is for GNOME (don't have GNOME on my system, don't know), kdm is for KDE and xdm is if you don't have either of those. Only one of those will get started and it will handle the functions of getty and login. So what does getty do? If you set your default run level to 3 (you can do that, just edit /etc/inittab and log out). Run level 3 takes you to a console, getty opens a port, prints a login prompt and initiates a login process (you enter your user and password). If you type correctly, you get logged in and are prompted to enter commands until you exit (type Ctrl-D or the word exit) which takes you back to the login prompt (yeah, it's the login program). You can, of course, star X running: simply enter Code:
startx You can always edit /etc/inittab and set the default run level back to 4. Bottom line, nope, it's not a shell, it's a display manager (that might actually invoke a shell for the login and password but probably not). You may want to look at the manual pages for init, getty, login and gdm, kdm or xdm (xdm is a manual page, gdm and kdm are probably info pages). Hope this helps some. |
All times are GMT -5. The time now is 05:39 AM. |