Welcome to Soft32 Linux Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

how do i automate gpasswd?

 
   Soft32 Home -> Linux -> System Development RSS
Next:  IE8: Open sidebar, crash, system hosed, reinstall..  
Author Message
zix

External


Since: Dec 10, 2008
Posts: 15



(Msg. 1) Posted: Mon Jul 06, 2009 1:02 am
Post subject: how do i automate gpasswd?
Archived from groups: comp>os>linux>development>system (more info?)

Hi,
I can automate to enter passwd by (echo newpass;sleep 1;echo
newpass|grep passwd), but if i apply the same over gpasswd, it gives

(echo new;sleep 1;echo new|gpasswd expertgrp)
new
gpasswd: Not a tty

how to get rid of this and automate it(without using expect)? any clue/
idea?

Thanks,
zix
Back to top
Login to vote
Mark Hobley

External


Since: Nov 02, 2008
Posts: 108



(Msg. 2) Posted: Mon Jul 06, 2009 7:20 am
Post subject: Re: how do i automate gpasswd? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

zix <zixenus.DeleteThis@gmail.com> wrote:
> gpasswd: Not a tty
>
> how to get rid of this and automate it(without using expect)? any clue/
> idea?

There are a couple tools that give that "Not a tty" error. I think they need
to be modified to allow them to operate under such conditions. I haven't really
looked at this, but it is on my "to do" list, so I am interested in any
developments that are made in this area.

Mark.

--
Mark Hobley
Linux User: #370818 http://markhobley.yi.org/
Back to top
Login to vote
Joe Beanfish

External


Since: Apr 14, 2006
Posts: 22



(Msg. 3) Posted: Mon Jul 06, 2009 1:20 pm
Post subject: Re: how do i automate gpasswd? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

zix wrote:
> Hi,
> I can automate to enter passwd by (echo newpass;sleep 1;echo
> newpass|grep passwd), but if i apply the same over gpasswd, it gives
>
> (echo new;sleep 1;echo new|gpasswd expertgrp)
> new
> gpasswd: Not a tty
>
> how to get rid of this and automate it(without using expect)? any clue/
> idea?

That message indicates that the program, gpasswd, is intentionally checking
if you are a user typing vs. piping/redirecting like you're doing. Chances
are there's no way around it unless gpasswd has a command line option to
not require tty. You may need a different tool.
Back to top
Login to vote
Josef Moellers

External


Since: Apr 03, 2009
Posts: 10



(Msg. 4) Posted: Tue Jul 07, 2009 3:20 am
Post subject: Re: how do i automate gpasswd? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Joe Beanfish wrote:
> zix wrote:
>> Hi,
>> I can automate to enter passwd by (echo newpass;sleep 1;echo
>> newpass|grep passwd), but if i apply the same over gpasswd, it gives
>>
>> (echo new;sleep 1;echo new|gpasswd expertgrp)
>> new
>> gpasswd: Not a tty
>>
>> how to get rid of this and automate it(without using expect)? any clue/
>> idea?
>
> That message indicates that the program, gpasswd, is intentionally checking
> if you are a user typing vs. piping/redirecting like you're doing. Chances
> are there's no way around it unless gpasswd has a command line option to
> not require tty. You may need a different tool.

More likely, gpasswd wants to disable echo via tcgetattr/tcsetattr/ioctl
and this definitely fails if stdin is "Not a tty".
The manual page does not show an option to circumvent this.

--
These are my personal views and not those of Fujitsu Technology Solutions!
Josef Möllers (Pinguinpfleger bei FTS)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://de.ts.fujitsu.com/imprint.html
Back to top
Login to vote
Display posts from previous:   
Related Topics:
RFC3971 - Does anyone know if RFC3971 support is being developed for Linux? It does not seem to be implemented in the mainline..

Size 8 bit, 16 bit, 32 bit and 64 bit systems. - I need to find out what is the size of following data structures in 8 bit, 16 bit, 32 bit, and 64 bit systems. struct....

Size 8 bit, 16 bit, 32 bit and 64 bit systems. - I need to find out what is the size of following data structures in 8 bit, 16 bit, 32 bit, and 64 bit systems. struct....

Access shared memory from kernel module - Hi All, I wanted to know if shared memory created in user space can be accessed from a loadable kernel module. Have no...

Controlling UART transmission of bytes - I'm programming an ARM's UART that comes with a library implementing the standard unix termios interface. Regarding..

[gentoo-user] gpasswd not function immediately? - I want to create a crontab for my account using "crontab -e". However system tells me I have no permission to...
       Soft32 Home -> Linux -> System Development All times are: Pacific 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

Categories:
 Windows
  Linux
 Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]