LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-27-2003, 12:44 PM   #1
reetep
Member
 
Registered: Oct 2003
Location: UK
Distribution: Debian
Posts: 122

Rep: Reputation: 15
using init command


I'd like to be able to use the init command without logging in as root. I get the following message at the moment:

[reetep@pc reetep]$ /sbin/init 5
init: must be superuser.

I spent this afternoon learning about file permissions in order to be able to change this. I have now done so:

[reetep@pc reetep]$ stat /sbin/init
...blah blah blah
Access (0777/-rwxrwxrwx)
...blah blah blah

but I still get the same error message. Can anyone suggest a way of getting it to work? Many thanks, reetep.

(I'm using RH9).
 
Old 10-27-2003, 12:47 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
Quote:
init: must be superuser.
... you need be by superuser, i.e. root. su to root and try again.
 
Old 10-27-2003, 12:58 PM   #3
reetep
Member
 
Registered: Oct 2003
Location: UK
Distribution: Debian
Posts: 122

Original Poster
Rep: Reputation: 15
Thanks for your reply Chris. I'm not sure what you mean. Are you saying there's no way of doing it without logging in as root? If there's a way of doing it without logging in as root, I'd love to know.

Thanks, reetep.
 
Old 10-27-2003, 01:01 PM   #4
aaa
LQ Guru
 
Registered: Jul 2003
Location: VA
Distribution: Slack 10.1
Posts: 2,194

Rep: Reputation: 46
'su to root'; ie run this command: 'su -', then enter the root password when prompted.

Sudo might help, it lets other users use certain commands specified in the 'sudoers' file.
 
Old 10-27-2003, 03:17 PM   #5
reetep
Member
 
Registered: Oct 2003
Location: UK
Distribution: Debian
Posts: 122

Original Poster
Rep: Reputation: 15
Thanks for your suggestions. Using sudo was a particularly good idea. Unfortunately it doesn't seem to have worked.

I've had to read up about it, cos I hadn't heard of it before; but I'm 99% certain that I know how to use the command now, that what I've done is correct and that it should work. My sudoers file now looks like this:

#User privilege specification
root ALL=(ALL) ALL
reetep pc=(root) /sbin/init

typing sudo -l as reetep gives:

User reetep may run the following commands on this host:
(root) /sbin/init

yet when I type "/sbin/init 5" I still get the same error message:
init: must be superuser.

The same applies even when I modify sudoers as follows:

#User privilege specification
root ALL=(ALL) ALL
reetep ALL=(ALL) ALL

ie I still get the same error message "must be superuser."

I'm very grateful for the help you've given. Unless any other ideas spring immediately to mind, then don't worry about it and many thanks. I'm just writing this because I thought you might be interested to hear whether it worked.

On the other hand if ideas do spring to mind then please help. I'd be very grateful! I know I can just switch to root when I need to use the command, but I do it quite a lot (the startkde command doesn't work you see, but init 5 will load the kde desktop), and I don't feel comfortable working as root all the time (as I've heard that you can really trash your system).

Of course, if no-one has any ideas, then I can try my luck with a thread on fixing the real problem here -that is the startkde command.

Thanks a lot, reetep.
 
Old 10-27-2003, 03:21 PM   #6
reetep
Member
 
Registered: Oct 2003
Location: UK
Distribution: Debian
Posts: 122

Original Poster
Rep: Reputation: 15
PS I know that I can change the inittab to load level 5 as default, but I like to load to 3 so that I can choose between windowmaker and the kde/gnome desktop. So that's not a quick fix either really. Thanks, reetep.
 
Old 10-27-2003, 03:41 PM   #7
robartes
Member
 
Registered: Oct 2003
Location: Mechelen, BE
Distribution: Mandrake as base, most software hand rolled
Posts: 80

Rep: Reputation: 15
Re: using init command

Quote:
Originally posted by reetep
I'd like to be able to use the init command without logging in as root. I get the following message at the moment:

[reetep@pc reetep]$ /sbin/init 5
init: must be superuser.

You can't use init without being root (init checks that the EUID is 0). You need to set the setuid bit on /sbin/init (bad idea) or use sudo.

BTW, you need to type 'sudo /sbin/init 5', not just '/sbin/init 5'. It's not because you're in sudoers that it will suddenly magically work - you need to run your stuff through the sudo command.

Last edited by robartes; 10-27-2003 at 03:42 PM.
 
Old 10-27-2003, 04:11 PM   #8
reetep
Member
 
Registered: Oct 2003
Location: UK
Distribution: Debian
Posts: 122

Original Poster
Rep: Reputation: 15
Thanks robartes, you've done it for me. I WAS actually running /sbin/init through the sudo command, except I was typing sudo | /sbin.init 5, as suggested by the manual. (Or at least that's what I think the manual says you should do. Maybe I'm not interpreting the syntax statement properly).

But anyway sudo /sbin/init 5 does it, (I same thing without the pipe), so thanks a lot everyone. You guys are great!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
An error occured getting IPtables status from the command /etc/rc.d/init.d/iptables s CrazyMAzeY Linux - Newbie 10 08-12-2010 06:25 AM
init cannot execute /command/svscanboot puter_gk Linux - Networking 1 02-25-2005 12:36 PM
How do you change INIT startup to level 3 (graphical) from command line? Fear58 Linux - Newbie 2 06-25-2004 09:15 PM
Kernal Panic: No init found. Try passing init= option to kernel raees Linux - General 12 03-19-2004 12:10 AM
error "Kernel panic: No init found. Try passing init= option Anauj0101 Linux - Newbie 3 05-06-2003 11:18 PM


All times are GMT -5. The time now is 01:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration