Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
This is my understanding anyway. The problem I am running into is that my php script is not working for the echo command. However, there are two undesirable work arounds I can do to make it work:
1. chown apache.apache /etc/resolv.conf
2. chmod 666 /etc/resolv.conf
I don't like either solution, even though I have tested them both and they do indeed mitigate the problem I am having. I would rather get the sudo command working as it should. Does anyone here have any suggestions?
IMO the traditional Unix way to do this would be to change the group ownership of the file to apache leaving the user ownership as root. There is absolutely nothing wrong with this solution. Also, it is much better than setting NOPASSWD on any user account in the sudoers file. I agree that changing the permissions to 666 is not acceptable.
Thanks for the tip, thats a very good way to go about it. What I decided to do in the end was rearrange the command that modifies the file. What I was doing was trying to sudo echo, which is clearly wrong since that is not a command that is restricted to root. Anyone can echo. However, my thinking was that if I echoed as root I'd be able to modify the file. This wasn't working so I did this instead, at the advice of someone over at the ubuntu forums:
echo 'nameserver 10.0.0.1' | sudo tee /etc/resolv.conf
I like your idea of changing the group ownership though.