Hi everyone. I am attempting to add this line to /etc/inittab so that a
user will be forced to enter a password to get into single user mode:
~:S:wait:/sbin/sulogin
I have tried all kinds of things, but seem to be having no luck. Here is
the puppet class I am trying to make:
class gen000020 {
# Description: The UNIX host is bootable in single user mode
without a password.
# Insert "~~:S:wait:/sbin/sulogin" into /etc/inittab
augeas { "inittab" :
context => "/files/etc/inittab",
changes => [
"set ~ /~",
"set ~/runlevels S",
"set ~/action wait",
"set ~/process /sbin/sulogin",
]
}
}
Here is the pertinent debug output from a manual run feeding that code to
puppet:
debug: Augeas[inittab](provider=augeas): Opening augeas with root /, lens
path , flags 0
debug: Augeas[inittab](provider=augeas): Augeas version 0.5.0 is installed
debug: Augeas[inittab](provider=augeas): Will attempt to save and only run
if files changed
debug: Augeas[inittab](provider=augeas): sending command ''set''
with params
["/files/etc/inittab/~", "/~"]
debug: Augeas[inittab](provider=augeas): sending command ''set''
with params
["/files/etc/inittab/~/runlevels", "S"]
debug: Augeas[inittab](provider=augeas): sending command ''set''
with params
["/files/etc/inittab/~/action", "wait"]
debug: Augeas[inittab](provider=augeas): sending command ''set''
with params
["/files/etc/inittab/~/process", "/sbin/sulogin"]
debug: Augeas[inittab](provider=augeas): Files changed, should execute
debug: Augeas[inittab](provider=augeas): Closed the augeas connection
debug: //ia/Augeas[inittab]: Changing returns
debug: //ia/Augeas[inittab]: 1 change(s)
debug: Augeas[inittab](provider=augeas): Opening augeas with root /, lens
path , flags 0
debug: Augeas[inittab](provider=augeas): Augeas version 0.5.0 is installed
debug: Augeas[inittab](provider=augeas): sending command ''set''
with params
["/files/etc/inittab/~", "/~"]
debug: Augeas[inittab](provider=augeas): sending command ''set''
with params
["/files/etc/inittab/~/runlevels", "S"]
debug: Augeas[inittab](provider=augeas): sending command ''set''
with params
["/files/etc/inittab/~/action", "wait"]
debug: Augeas[inittab](provider=augeas): sending command ''set''
with params
["/files/etc/inittab/~/process", "/sbin/sulogin"]
debug: Augeas[inittab](provider=augeas): Closed the augeas connection
err: //ia/Augeas[inittab]/returns: change from need_to_run to 0 failed: Save
failed with return code false
debug: Finishing transaction -612453418 with 1 changes
Can anyone show me the proper way to insert this line into inittab using
augeas and puppet?
Thanks
Kit Stube
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
My inittab is slightly different, does this work for you?
class inittab {
define conf (
$id,
$runlevels = ''123456'',
$action = ''respawn'',
$process
) {
augeas {"inittab_$id":
context => "/files/etc/inittab",
changes => [
"set $id/runlevels $runlevels",
"set $id/action $action",
"set $id/process
''$process''",
],
}
}
}
and I call that definition as follows:
inittab::conf{"supervisor":
id => ''supe'',
runlevels => ''a'',
action => ''respawn'',
process => ''/usr/bin/supervisord -n'',
# this require is actually evaluated in the inittab::conf
definition
require => [Exec["install
supervisor"],Package["python-setuptools"]],
}
On Thu, Sep 2, 2010 at 4:47 PM, Kit Stube <kstube@gmail.com> wrote:
> Hi everyone. I am attempting to add this line to /etc/inittab so that a
> user will be forced to enter a password to get into single user mode:
>
> ~:S:wait:/sbin/sulogin
>
> I have tried all kinds of things, but seem to be having no luck. Here is
> the puppet class I am trying to make:
>
> class gen000020 {
> # Description: The UNIX host is bootable in single user mode
> without a password.
> # Insert "~~:S:wait:/sbin/sulogin" into
/etc/inittab
>
> augeas { "inittab" :
> context => "/files/etc/inittab",
> changes => [
> "set ~ /~",
> "set ~/runlevels S",
> "set ~/action wait",
> "set ~/process /sbin/sulogin",
> ]
> }
> }
>
>
> Here is the pertinent debug output from a manual run feeding that code to
> puppet:
>
>
>
> debug: Augeas[inittab](provider=augeas): Opening augeas with root /, lens
> path , flags 0
> debug: Augeas[inittab](provider=augeas): Augeas version 0.5.0 is installed
> debug: Augeas[inittab](provider=augeas): Will attempt to save and only run
> if files changed
> debug: Augeas[inittab](provider=augeas): sending command
''set'' with params
> ["/files/etc/inittab/~", "/~"]
> debug: Augeas[inittab](provider=augeas): sending command
''set'' with params
> ["/files/etc/inittab/~/runlevels", "S"]
> debug: Augeas[inittab](provider=augeas): sending command
''set'' with params
> ["/files/etc/inittab/~/action", "wait"]
> debug: Augeas[inittab](provider=augeas): sending command
''set'' with params
> ["/files/etc/inittab/~/process", "/sbin/sulogin"]
> debug: Augeas[inittab](provider=augeas): Files changed, should execute
> debug: Augeas[inittab](provider=augeas): Closed the augeas connection
> debug: //ia/Augeas[inittab]: Changing returns
> debug: //ia/Augeas[inittab]: 1 change(s)
> debug: Augeas[inittab](provider=augeas): Opening augeas with root /, lens
> path , flags 0
> debug: Augeas[inittab](provider=augeas): Augeas version 0.5.0 is installed
> debug: Augeas[inittab](provider=augeas): sending command
''set'' with params
> ["/files/etc/inittab/~", "/~"]
> debug: Augeas[inittab](provider=augeas): sending command
''set'' with params
> ["/files/etc/inittab/~/runlevels", "S"]
> debug: Augeas[inittab](provider=augeas): sending command
''set'' with params
> ["/files/etc/inittab/~/action", "wait"]
> debug: Augeas[inittab](provider=augeas): sending command
''set'' with params
> ["/files/etc/inittab/~/process", "/sbin/sulogin"]
> debug: Augeas[inittab](provider=augeas): Closed the augeas connection
> err: //ia/Augeas[inittab]/returns: change from need_to_run to 0 failed:
> Save failed with return code false
> debug: Finishing transaction -612453418 with 1 changes
>
> Can anyone show me the proper way to insert this line into inittab using
> augeas and puppet?
>
> Thanks
>
> Kit Stube
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
>
puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
--
Jason Koppe
Jason.Robert.Koppe@gmail.com
Cell (210) 445-8242
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
On Sep 2, 2010, at 5:47 PM, Kit Stube wrote:> changes => [ > "set ~ /~", > "set ~/runlevels S", > "set ~/action wait", > "set ~/process /sbin/sulogin", > ]Try removing the first item in your changes. In many cases, Augeas will create a path for you if you set something that doesn''t exist. I have a resource that adds to inittab and it''s almost identical to yours, but it only has the last 3 changes. If it still doesn''t work, it may be that something doesn''t like the ~ character. -- Rob McBroom <http://www.skurfer.com/> Before you give the government new power to go after bad guys, remember this: The power will be permanent. The definition of “bad guys ” will not. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thanks for the replies. I tried Rob''s fix first since it just meant
removing one line from what I had. It worked like a charm!
Here is the final config to add that line to /etc/inittab:
augeas { "inittab" :
context => "/files/etc/inittab",
changes => [
"set ~/runlevels S",
"set ~/action wait",
"set ~/process /sbin/sulogin",
]
}
On Fri, Sep 3, 2010 at 7:44 AM, Rob McBroom
<mailinglist0@skurfer.com>wrote:
> On Sep 2, 2010, at 5:47 PM, Kit Stube wrote:
>
> changes => [
> "set ~ /~",
> "set ~/runlevels S",
> "set ~/action wait",
> "set ~/process /sbin/sulogin",
> ]
>
>
> Try removing the first item in your changes. In many cases, Augeas will
> create a path for you if you set something that doesn''t exist. I
have a
> resource that adds to inittab and it''s almost identical to yours,
but it
> only has the last 3 changes. If it still doesn''t work, it may be
that
> something doesn''t like the ~ character.
>
> --
> Rob McBroom
> <http://www.skurfer.com/>
>
> Before you give the government new power to go after bad guys, remember
> this: The power will be permanent. The definition of “bad guys ” will not.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
>
puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.