LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 09-14-2010, 05:58 PM   #1
treznik
LQ Newbie
 
Registered: Sep 2010
Posts: 8

Rep: Reputation: 0
Apache2 permissions for user


Hi, this question is a bit stupid but I'm left clueless.

I want to let a regular user (not just root) restart apache on my Ubuntu machine.

I was using /etc/init.d/apache2 so I figured this is what I have to set permissions for. I set the owner group for this file a group to which that user also belongs. I set the chmod to 775 but it didn't work. I then even set it to 4775 thinking this would totally make it work but it still didn't.

I'm obviously giving permissions to the wrong file.

The error says:
Quote:
httpd not running, trying to start
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
But I didn't find httpd anywhere on my machine.

What am I missing? Thanks!
 
Old 09-14-2010, 06:35 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 151Reputation: 151
Are you familiar with sudo? You can add an entry for /etc/init.d/apache2 with visudo and the user would type:
Code:
sudo /etc/init.d/apache2 start
 
Old 09-15-2010, 04:53 AM   #3
treznik
LQ Newbie
 
Registered: Sep 2010
Posts: 8

Original Poster
Rep: Reputation: 0
I know what it does, but I haven't worked much around it.

For starters I need this to be inside a script, so I would like it not to ask for a password. I'm not familiar with visudo though. I'll look it up but if it's something easy to explain or exemplify, please. Is it a file where I add file entries?

Also, how is sudo different from setting the suid bit? which from what I learned does the same: make a file run with the permissions of the executable's owner.

Thanks!
 
Old 09-15-2010, 05:07 AM   #4
sag47
Senior Member
 
Registered: Sep 2009
Location: Philly, PA
Distribution: Kubuntu x64, RHEL, Fedora Core, FreeBSD, Windows x64
Posts: 1,422
Blog Entries: 33

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
suid is for setting the userid to the owner when the executable is run by any user. If your user doesn't have administrative access to the directory then the suid is useless except for a root-like user (such as the sudo command) or by root itself.

The visudo command edits /etc/sudoers file. The sudoers file is what gives users administrative access or restricted access to certain parts of the system when the sudo command is used to execute a command with administrative privileges. You can set up the sudo command to be run by certain users or groups without a password if you add an entry within the /etc/sudoers files by executing the visudo command to edit it.

You may be interested in the following post...
http://www.linuxquestions.org/questi...ml#post4096968

Google man sudoers for more information on configuring the sudoers file.

Last edited by sag47; 09-15-2010 at 05:11 AM.
 
1 members found this post helpful.
Old 09-15-2010, 06:06 AM   #5
treznik
LQ Newbie
 
Registered: Sep 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks for the clarification.

One question though, is it OK that is saves a file called sudoers.tmp? is tmp from temporary?
 
Old 09-15-2010, 11:20 AM   #6
sag47
Senior Member
 
Registered: Sep 2009
Location: Philly, PA
Distribution: Kubuntu x64, RHEL, Fedora Core, FreeBSD, Windows x64
Posts: 1,422
Blog Entries: 33

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Yes tmp is temporary; It is only there when you're running the visudo command. If you computer crashes while you're editing the sudoers then you'll still definitely have a working copy of your sudoers. When you're done editing, save, and quit visudo then sudoers.tmp is discarded and the newly saved copy of your sudoers is used.

I prefer to just manually backup my sudoers and edit it using vim (visudo uses nano). However the visudo command is the standard for many people.

Last edited by sag47; 09-15-2010 at 11:22 AM.
 
1 members found this post helpful.
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] iptables and tc permissions in apache2 systemlordanubis Linux - Software 2 08-01-2010 10:03 PM
[SOLVED] filesystem permissions question - making so user can't change permissions? c0pe Linux - Security 4 07-12-2010 09:06 AM
permissions, files and apache2 mohtech Linux - Server 1 05-18-2010 11:13 PM
apache2 + chmod 777 pipe permissions = ? mpapet Linux - Security 3 06-27-2006 07:40 PM
Apache2 on Suse 9.3 - File Permissions jacobt Linux - Software 3 12-02-2005 04:47 PM


All times are GMT -5. The time now is 06:55 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration