Unix Technical Forum

halt for users

This is a discussion on halt for users within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> On Wed, 23 Jun 2004 15:58:25 +0200, Tallis wrote: >> man sudo, sudoers > Yes I tried this but ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 02-19-2008, 11:38 AM
/dev/rob0
 
Posts: n/a
Default Re: halt for users

On Wed, 23 Jun 2004 15:58:25 +0200, Tallis wrote:
>> man sudo, sudoers

> Yes I tried this but probably I've got problems with sudoers file
> syntax. I tried examples from man pages and still got problems. Can you
> show me a good example.


Did you try "less /etc/sudoers" (must be root for this)? Or similarly,
"visudo" and uncomment one line in the file? I will not tell you which
line, but I'll give you a hint: look for "shutdown".
--
/dev/rob0 - preferred_email=i$((28*28+28))@softhome.net
or put "not-spam" or "/dev/rob0" in Subject header to reply

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 02-19-2008, 11:38 AM
Lew Pitcher
 
Posts: n/a
Default Re: halt for users

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

standardblue wrote:

> On Wed, 23 Jun 2004 07:56:22 -0400, Lew Pitcher wrote:
> <snip>
>
>>a) From any (character) console: <ctl><alt><del> will shutdown/reboot
>> (see the "ca" line in /etc/inittab)
>> (FWIW, <ctl><alt><Fx> will move you from a GUI to a console, where
>> you can then <ctl><alt><del> to shutdown)

>
> <snip>
>
> ...and for any other newbie stupid enough to try <ctrl><alt><Fx> to see
> what it does... (ahem)...


Well, it (and <alt><Fx>) move you from virtual console to virtual
terminal. When your virtual terminal is running X, you have to add the
<ctl>, otherwise X will intercept the keystroke and you won't move.

Now, how do you know which terminals to move to? Well, your /etc/inittab
and your /etc/rc.d/rc.5 tell you. In /etc/inittab, you'll see a number
of lines that look like this...
# These are the standard console login getties in multiuser mode:
c1:1235:respawn:/sbin/agetty 38400 tty1 linux
c2:1235:respawn:/sbin/agetty 38400 tty2 linux
c3:1235:respawn:/sbin/agetty 38400 tty3 linux
c4:1235:respawn:/sbin/agetty 38400 tty4 linux
c5:1235:respawn:/sbin/agetty 38400 tty5 linux
c6:12345:respawn:/sbin/agetty 38400 tty6 linux

Each one of those 'respawn' lines starts up a virtual terminal
F1 corresponds to the c1 line that starts tty1,
F2 corresponds to the c2 line that starts tty2,
and so on.

The numbers after the first colon tell you which runlevel(s) the line
applies to. So, if you boot into runlevel 4, only the c6 line that
starts tty6 will be active (it's the only one that starts in runlevel
4). So, [<ctl>]<alt><F6> will take you to the getty login on the tty6
virtual terminal.

Now, where is your X session? If you don't tell X otherwise, it starts
the X session on the first free console after the last used one. In
other words, without any overriding instructions, in this case X will
start the session on tty7, and you'd get to tty7 through [<ctl>]<alt><F7>.

So, what was that you saw on tty1 (F1)? Well, Linux also allocates a
special device called the "console" (/dev/console) and places it on tty1
unless otherwise instructed. When you [<ctl>]<alt><F1>, you ended up
looking at /dev/console. /dev/console is special; that's where the
startup messages are sent, so that's what you saw when you got there.

Assuming that none of the other consoles were started, you got only
blank screens when you [<ctl>]<alt><Fx>'ed to them.


And, that's that ;-)
> my subsequent trial-and-error revealed that <alt><F7> brought me back into
> x-windows!
>
> oopsie...
>
> sb



- --

Lew Pitcher, IT Consultant, Enterprise Application Architecture
Enterprise Technology Solutions, TD Bank Financial Group

(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)

iD8DBQFA2c1sagVFX4UWr64RAs3OAJ9PU7++h6cDrdv4kpq+xe 7ukLlq7ACgz59c
h32G91w5u3qfIj2YNxQlWr0=
=1hZa
-----END PGP SIGNATURE-----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 02-19-2008, 11:38 AM
An Metet
 
Posts: n/a
Default Re: halt for users

NOTE: This message was sent thru a mail2news gateway.
No effort was made to verify the identity of the sender.
--------------------------------------------------------

pgp trash troll delete

Lew Pitcher <Lew.Pitcher@td.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1


> standardblue wrote:


> > On Wed, 23 Jun 2004 07:56:22 -0400, Lew Pitcher wrote:
> > <snip>
> >
> >>a) From any (character) console: <ctl><alt><del> will shutdown/reboot
> >> (see the "ca" line in /etc/inittab)
> >> (FWIW, <ctl><alt><Fx> will move you from a GUI to a console, where
> >> you can then <ctl><alt><del> to shutdown)

> >
> > <snip>
> >
> > ...and for any other newbie stupid enough to try <ctrl><alt><Fx> to see
> > what it does... (ahem)...


> Well, it (and <alt><Fx>) move you from virtual console to virtual
> terminal. When your virtual terminal is running X, you have to add the
> <ctl>, otherwise X will intercept the keystroke and you won't move.


> Now, how do you know which terminals to move to? Well, your /etc/inittab
> and your /etc/rc.d/rc.5 tell you. In /etc/inittab, you'll see a number
> of lines that look like this...
> # These are the standard console login getties in multiuser mode:
> c1:1235:respawn:/sbin/agetty 38400 tty1 linux
> c2:1235:respawn:/sbin/agetty 38400 tty2 linux
> c3:1235:respawn:/sbin/agetty 38400 tty3 linux
> c4:1235:respawn:/sbin/agetty 38400 tty4 linux
> c5:1235:respawn:/sbin/agetty 38400 tty5 linux
> c6:12345:respawn:/sbin/agetty 38400 tty6 linux


> Each one of those 'respawn' lines starts up a virtual terminal
> F1 corresponds to the c1 line that starts tty1,
> F2 corresponds to the c2 line that starts tty2,
> and so on.


> The numbers after the first colon tell you which runlevel(s) the line
> applies to. So, if you boot into runlevel 4, only the c6 line that
> starts tty6 will be active (it's the only one that starts in runlevel
> 4). So, [<ctl>]<alt><F6> will take you to the getty login on the tty6
> virtual terminal.


> Now, where is your X session? If you don't tell X otherwise, it starts
> the X session on the first free console after the last used one. In
> other words, without any overriding instructions, in this case X will
> start the session on tty7, and you'd get to tty7 through [<ctl>]<alt><F7>.


> So, what was that you saw on tty1 (F1)? Well, Linux also allocates a
> special device called the "console" (/dev/console) and places it on tty1
> unless otherwise instructed. When you [<ctl>]<alt><F1>, you ended up
> looking at /dev/console. /dev/console is special; that's where the
> startup messages are sent, so that's what you saw when you got there.


> Assuming that none of the other consoles were started, you got only
> blank screens when you [<ctl>]<alt><Fx>'ed to them.



> And, that's that ;-)
> > my subsequent trial-and-error revealed that <alt><F7> brought me back into
> > x-windows!
> >
> > oopsie...
> >
> > sb



> - --


> Lew Pitcher, IT Consultant, Enterprise Application Architecture
> Enterprise Technology Solutions, TD Bank Financial Group


> (Opinions expressed here are my own, not my employer's)
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (MingW32)


> iD8DBQFA2c1sagVFX4UWr64RAs3OAJ9PU7++h6cDrdv4kpq+xe 7ukLlq7ACgz59c
> h32G91w5u3qfIj2YNxQlWr0=
> =1hZa
> -----END PGP SIGNATURE-----











































Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 02-19-2008, 11:39 AM
chud
 
Posts: n/a
Default Re: halt for users

On Wed, 23 Jun 2004 14:35:25 -0400, Lew Pitcher wrote:

>
> The numbers after the first colon tell you which runlevel(s) the line
> applies to. So, if you boot into runlevel 4, only the c6 line that starts
> tty6 will be active (it's the only one that starts in runlevel 4). So,
> [<ctl>]<alt><F6> will take you to the getty login on the tty6 virtual
> terminal.
>


I always wondered why only tty6 has a login prompt, and the other tty's
don't. Thanks for the explanation.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 02-19-2008, 11:39 AM
chud
 
Posts: n/a
Default Re: halt for users

On Wed, 23 Jun 2004 15:58:25 +0200, Tallis wrote:

> Yes I tried this but probably I've got problems with sudoers file syntax.
> I tried examples from man pages and still got problems. Can you show me a
> good example.


Here's the relevant stuff from my /etc/sudoers,


# User alias specification
User_Alias CHUDADMIN = chud

# Cmnd alias specification
Cmnd_Alias HLT = /sbin/halt
Cmnd_Alias RBOOT = /sbin/reboot

# Defaults specification

# User privilege specification
root ALL=(ALL) ALL
CHUDADMIN ALL = NOPASSWD: HLT,RBOOT


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 02-19-2008, 11:39 AM
standardblue
 
Posts: n/a
Default Re: halt for users

On Wed, 23 Jun 2004 14:35:25 -0400, Lew Pitcher wrote:

<snip about terminals/consoles>

Thanks Lew, I didn't know any of that. Quite interesting, and probably
good to know at some point!

> Now, where is your X session? If you don't tell X otherwise, it starts
> the X session on the first free console after the last used one. In
> other words, without any overriding instructions, in this case X will
> start the session on tty7, and you'd get to tty7 through
> [<ctl>]<alt><F7>.


So, does that mean that I could add more terminals by adding a line
starting cN, and with ttyN? (where N is between 7 and 12 - the number of
function keys on a keyboard)?
And, if I did, and <ctrl><alt><Fx>'d out of x-windows, and had 12
consoles, how would I get back in - there's no F13?

> So, what was that you saw on tty1 (F1)? Well, Linux also allocates a
> special device called the "console" (/dev/console) and places it on tty1
> unless otherwise instructed. When you [<ctl>]<alt><F1>, you ended up
> looking at /dev/console. /dev/console is special; that's where the
> startup messages are sent, so that's what you saw when you got there.


I figured something like that, but thanks for putting me right as opposed
to my usual 'well, i think it should do this, so i'll do that... *splat*'
method ;-)

> Assuming that none of the other consoles were started, you got only
> blank screens when you [<ctl>]<alt><Fx>'ed to them.


I got the login prompt on each of mine - I'd already used 1 to log in, and
2 to do something as root before logging out of that and starting
x-windows as a normal user in 1.

>
> And, that's that ;-)


Thanks

sb

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 02-19-2008, 11:39 AM
Lew Pitcher
 
Posts: n/a
Default Re: halt for users

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

standardblue wrote:
| On Wed, 23 Jun 2004 14:35:25 -0400, Lew Pitcher wrote:
|
| <snip about terminals/consoles>
|
| Thanks Lew, I didn't know any of that. Quite interesting, and probably
| good to know at some point!
|
|
|>Now, where is your X session? If you don't tell X otherwise, it starts
|>the X session on the first free console after the last used one. In
|>other words, without any overriding instructions, in this case X will
|>start the session on tty7, and you'd get to tty7 through
|>[<ctl>]<alt><F7>.
|
|
| So, does that mean that I could add more terminals by adding a line
| starting cN, and with ttyN? (where N is between 7 and 12 - the number of
| function keys on a keyboard)?

No, but close.

Here's that /etc/inittab fragment again
~ # These are the standard console login getties in multiuser mode:
~ c1:1235:respawn:/sbin/agetty 38400 tty1 linux
~ c2:1235:respawn:/sbin/agetty 38400 tty2 linux
~ c3:1235:respawn:/sbin/agetty 38400 tty3 linux
~ c4:1235:respawn:/sbin/agetty 38400 tty4 linux
~ c5:1235:respawn:/sbin/agetty 38400 tty5 linux
~ c6:12345:respawn:/sbin/agetty 38400 tty6 linux

It's the /second/ field that tells init when to start the named process.
In the standard Slackware inittab, tty1 through tty5 are only started when you
enter runlevel 1 or 2 or 3 or 5, while tty6 is started when you enter runlevel
1 or 2 or 3 or 4 or 5. Notice anything about that list of runlevels?

The second field of the inittab indicates which runlevels to run the process
under. If you wanted to start more 'console' text terminals when you enter run
level 4 (the run level under which X starts), you'd have some entries with a 4
in that field. You can just edit /etc/inittab, and /add/ a 4 to the runlevels
for c1 through c5, and you'll get terminals on tty1 (F1) through tty5 (F5).
/That/ inittab would look like
~ # All the terminals are started up in X mode (runlevel 4)
~ c1:12345:respawn:/sbin/agetty 38400 tty1 linux
~ c2:12345:respawn:/sbin/agetty 38400 tty2 linux
~ c3:12345:respawn:/sbin/agetty 38400 tty3 linux
~ c4:12345:respawn:/sbin/agetty 38400 tty4 linux
~ c5:12345:respawn:/sbin/agetty 38400 tty5 linux
~ c6:12345:respawn:/sbin/agetty 38400 tty6 linux

You can even add more terminals (here, tty7 @ F7 and tty8 @ F8)
~ # X7 and X8 are ttys (tty7 and tty8) that only run when X is up
~ X7:4:respawn:/sbin/agetty 38400 tty7 linux
~ X8:4:respawn:/sbin/agetty 38400 tty8 linux

Take a look at the inittab(5) manpage ('man 5 inittab') to learn more about
how inittab works. For Linux sysadms, it's something worth knowing, and I
can't imagine a Slackware sysadm that isn't interested in it.


| And, if I did, and <ctrl><alt><Fx>'d out of x-windows, and had 12
| consoles, how would I get back in - there's no F13?

IIRC, [<ctrl>]<alt><SHIFT><F1>
F13 through F24 are shifted F1 through F12

[snip]
| Thanks

You're quite welcome. Anything for a fellow Slacker <grin>



- --
Lew Pitcher

Master Codewright & JOAT-in-training | GPG public key available on request
Registered Linux User #112576 (http://counter.li.org/)
Slackware - Because I know what I'm doing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFA2jS9agVFX4UWr64RAgciAJ9i24F0IJGB2auG3Te47U OAmsQJigCePkGq
WOgbK4+fOCYD6ac6xJvhduw=
=+s/9
-----END PGP SIGNATURE-----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 02-19-2008, 11:40 AM
Fritz Wuehler
 
Posts: n/a
Default Re: halt for users

pgp trash troll delete

Lew Pitcher <lpitcher@sympatico.ca> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1


> standardblue wrote:
> | On Wed, 23 Jun 2004 14:35:25 -0400, Lew Pitcher wrote:
> |
> | <snip about terminals/consoles>
> |
> | Thanks Lew, I didn't know any of that. Quite interesting, and probably
> | good to know at some point!
> |
> |
> |>Now, where is your X session? If you don't tell X otherwise, it starts
> |>the X session on the first free console after the last used one. In
> |>other words, without any overriding instructions, in this case X will
> |>start the session on tty7, and you'd get to tty7 through
> |>[<ctl>]<alt><F7>.
> |
> |
> | So, does that mean that I could add more terminals by adding a line
> | starting cN, and with ttyN? (where N is between 7 and 12 - the number of
> | function keys on a keyboard)?


> No, but close.


> Here's that /etc/inittab fragment again
> ~ # These are the standard console login getties in multiuser mode:
> ~ c1:1235:respawn:/sbin/agetty 38400 tty1 linux
> ~ c2:1235:respawn:/sbin/agetty 38400 tty2 linux
> ~ c3:1235:respawn:/sbin/agetty 38400 tty3 linux
> ~ c4:1235:respawn:/sbin/agetty 38400 tty4 linux
> ~ c5:1235:respawn:/sbin/agetty 38400 tty5 linux
> ~ c6:12345:respawn:/sbin/agetty 38400 tty6 linux


> It's the /second/ field that tells init when to start the named process.
> In the standard Slackware inittab, tty1 through tty5 are only started when you
> enter runlevel 1 or 2 or 3 or 5, while tty6 is started when you enter runlevel
> 1 or 2 or 3 or 4 or 5. Notice anything about that list of runlevels?


> The second field of the inittab indicates which runlevels to run the process
> under. If you wanted to start more 'console' text terminals when you enter run
> level 4 (the run level under which X starts), you'd have some entries with a 4
> in that field. You can just edit /etc/inittab, and /add/ a 4 to the runlevels
> for c1 through c5, and you'll get terminals on tty1 (F1) through tty5 (F5).
> /That/ inittab would look like
> ~ # All the terminals are started up in X mode (runlevel 4)
> ~ c1:12345:respawn:/sbin/agetty 38400 tty1 linux
> ~ c2:12345:respawn:/sbin/agetty 38400 tty2 linux
> ~ c3:12345:respawn:/sbin/agetty 38400 tty3 linux
> ~ c4:12345:respawn:/sbin/agetty 38400 tty4 linux
> ~ c5:12345:respawn:/sbin/agetty 38400 tty5 linux
> ~ c6:12345:respawn:/sbin/agetty 38400 tty6 linux


> You can even add more terminals (here, tty7 @ F7 and tty8 @ F8)
> ~ # X7 and X8 are ttys (tty7 and tty8) that only run when X is up
> ~ X7:4:respawn:/sbin/agetty 38400 tty7 linux
> ~ X8:4:respawn:/sbin/agetty 38400 tty8 linux


> Take a look at the inittab(5) manpage ('man 5 inittab') to learn more about
> how inittab works. For Linux sysadms, it's something worth knowing, and I
> can't imagine a Slackware sysadm that isn't interested in it.



> | And, if I did, and <ctrl><alt><Fx>'d out of x-windows, and had 12
> | consoles, how would I get back in - there's no F13?


> IIRC, [<ctrl>]<alt><SHIFT><F1>
> F13 through F24 are shifted F1 through F12


> [snip]
> | Thanks


> You're quite welcome. Anything for a fellow Slacker <grin>




> - --
> Lew Pitcher


> Master Codewright & JOAT-in-training | GPG public key available on request
> Registered Linux User #112576 (http://counter.li.org/)
> Slackware - Because I know what I'm doing.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org


> iD8DBQFA2jS9agVFX4UWr64RAgciAJ9i24F0IJGB2auG3Te47U OAmsQJigCePkGq
> WOgbK4+fOCYD6ac6xJvhduw=
> =+s/9
> -----END PGP SIGNATURE-----






















































Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:05 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com