ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
well... i'm sure it's possible. compiling against the kernel headers might be one way to go (and you'd be totally on your own there ), but running "exit" or "logout" using an exec variant would probably be the easiest way to go outside of a shell script. i'm not sure the shell script would even work.
Originally posted by acromi yeah, ive tried using exit..but i couldnt get it to work. maybe (dont hate me =) you could give me an example. pretty please...
you know you cant resist
lol - you don't know how true that is. this is gonna bug me for days.
anyway, i tried writing a quick shell script, and all that happened was that it exited from itself. nothing exciting.
offhand, if you want to write this prog, then you're going to need to learn more about the login process than i currently know. all i know is something vague about gettys and virtual consoles. i was wondering if it might be that a user-space prog can't access that particular function... it might be a security risk somehow.
ummm... try checking out the source to "su" - that seems like it might have something useful or similar.
im faily new to programming in a unix environment. i've been running a linux box for about a year i guess now, and im just trying to think of ways to get more familiar with how it ticks...and this is one of those ways...
let me know if you find anything, or if you get bored looking. in the meantime i will keep lookin for a solution (after i sleep a little)
logout isn't a program - it's a function in a shell program to terminate the shell. afaik, the login just activates a shell program, like bash, csh, tsh, ect, which then goes on to do all the other stuff, like X - after the original shell dies, the login terminates. so, we're looking for a way to kill the first shell after login. you can't call logout because it's a function inside the shell, and you don't have access to it if you're operating outside of it, as we hypotheticially are.
that would only work from the first shell - it wouldn't work inside X. what would work is to grep the output of 'ps -f' to get the shell program belonging to your user that has the lowest pid - that would be the first shell called after login, send it the SIGHUP.