Help!

making non-tty login sessions

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Security RSS
Next:  Slack 13.0 and nvidia binary driver  
Author Message
bing1351
External


Since: Aug 31, 2009
Posts: 4



PostPosted: Mon Aug 31, 2009 11:42 am    Post subject: making non-tty login sessions
Archived from groups: comp>os>linux>security (more info?)

I want to do the following:

main()
{
[code to listen and accept connections on port xxx]
s = accept(....

fork()
[the child process]
setpgrp();
close(0);
close(1);
close(2);
dup(s);
dup(s);
dup(s);

write(1, "Login:", 6);
n = read(0, buf, 99); /* not exactly stellar code but you get the
drift */

[do some processing on the input buf. this is the reason why I have to
do things this way.]

execl("/bin/login", "login", buf, NULL);
}

code runs, but after the execl, login fails with a "FATAL: bad tty" on
the system log.

How can I do this?

Thanks in advance

BING
Back to top
bing1351
External


Since: Aug 31, 2009
Posts: 4



PostPosted: Mon Aug 31, 2009 12:55 pm    Post subject: Re: making non-tty login sessions [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Aug 31, 3:36 pm, Bill Marcum <marcumb... RemoveThis @bellsouth.net> wrote:
> On 2009-08-31, bing1351 <bi... RemoveThis @tcsaa.com> wrote:> I want to do the following:
>
> > execl("/bin/login", "login", buf, NULL);
> > }
>
> > code runs, but after the execl, login fails with a "FATAL: bad tty" on
> > the system log.
>
> > How can I do this?
>
> Use a pty, or replace /bin/login with some other method to authenticate the
> user and start a shell as that user.

Can I prompt for the password and make the right calls into PAM right
in my code?
Pointers to example code links would be appreciated. I'm not well
versed in PAM.
Back to top
Bill Marcum
External


Since: Dec 18, 2006
Posts: 293



PostPosted: Mon Aug 31, 2009 4:10 pm    Post subject: Re: making non-tty login sessions [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 2009-08-31, bing1351 <bingb.RemoveThis@tcsaa.com> wrote:
> I want to do the following:
>
> execl("/bin/login", "login", buf, NULL);
> }
>
> code runs, but after the execl, login fails with a "FATAL: bad tty" on
> the system log.
>
> How can I do this?
>
Use a pty, or replace /bin/login with some other method to authenticate the
user and start a shell as that user.
Back to top
"C.
External


Since: Jan 28, 2009
Posts: 5



PostPosted: Wed Sep 02, 2009 5:18 am    Post subject: Re: making non-tty login sessions [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Aug 31, 8:55 pm, bing1351 <bi... RemoveThis @tcsaa.com> wrote:
> On Aug 31, 3:36 pm, Bill Marcum <marcumb... RemoveThis @bellsouth.net> wrote:
>
> > On 2009-08-31, bing1351 <bi... RemoveThis @tcsaa.com> wrote:> I want to do the following:
>
> > > execl("/bin/login", "login", buf, NULL);
> > > }
>
> > > code runs, but after the execl, login fails with a "FATAL: bad tty" on
> > > the system log.
>
> > > How can I do this?
>
> > Use a pty, or replace /bin/login with some other method to authenticate the
> > user and start a shell as that user.
>
> Can I prompt for the password and make the right calls into PAM right
> in my code?
> Pointers to example code links would be appreciated. I'm not well
> versed in PAM.

Yes - have a look at the pam_auth program bundled with the squid web
proxy.

have a look at http://www.linuxjournal.com/article/5940

Try google for more links/tutorials

And/or buy a copy of http://www.packtpub.com/pluggable-authentication-modules/book/hp/pam-abr/0608
(as such books go, its relatively cheap and even cheaper as a PDF)

C.
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Security All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can 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