Hopefully the last linux question for you guuys...

Posted by: SonicSnoop

Hopefully the last linux question for you guuys... - 07/06/2005 03:02

(At least for a while )
Sorry for all the questions you guys are the biggest bunch of intelligent people I know of.
Ok I have Ubuntu installed, I have also got apache/mysql/php installed and working. I also have sambs installed and working. currently I have to be root in order to add/del/edit any files i want in the /var/www dir .. How can I (or what is the correct way to) setup /var/www so that "user1" has all the add/del/edit rights and once I can do everything in that dir with that user is there anything i should be careful with when trying to add that dir to my samba config?? Thanks!
Posted by: msaeger

Re: Hopefully the last linux question for you guuys... - 07/06/2005 03:20

Yeah I want to know how to do that too. I keep having to log in a root.
Posted by: matthew_k

Re: Hopefully the last linux question for you guuys... - 07/06/2005 04:15

The best way to go about doing what you want is to create a group called "www" or "web", then chgrp the files and directory to be in that group, and change the permissions of the files to be read and writable by the group using chmod. Then later you can add anyone to the www group, and they will be able to modify the web files.

Of course, if you just want the quick and dirty way, a "chown -R username.username /var/www" should do what you want.

Background: Unix files belong to an owner and a group. The files can be specified to be readable, writeable and/or executable for the owner, the group, and everyone else. You can view all this by doing an "ls -l" which will produce output similar to:
-rw-r--r-- 1 root root 364 May 13 2002 index.html
The first character of that colum specifies if it's a directory, the next character if it's readable by the owner, the next if it's writable by the owner, the next if it's executable by the owner. Then it starts over for the group, then it starts over for everyone else.

These permissions are modified by the chmod command, which is usualy used by translating the numeric values to binary and setting those bits, thus "chmod 777 index.html" would change the output to:
-rwxrwxrwx 1 root root 364 May 13 2002 index.html
A simpler way to do this is a+r for "all plus read" and so on. See the man page for more information.

Hopefully that's enough to get you started.

Matthew
Posted by: matthew_k

Re: Hopefully the last linux question for you guuys... - 07/06/2005 04:19

Another thing I forgot to mention is that your web server traditionally runs as "nobody", meaning that the last set of permissions for everyone else needs to include readability if you want the files to be accessible to the web server.

As long as your samba server is doing some authentication before letting people at your web directory you should be all right. It's also always safer to specify which IP addresses can access the samba server in the config file.

Matthew
Posted by: wfaulk

Re: Hopefully the last linux question for you guuys... - 07/06/2005 14:01

Folks are telling you how to "fix" it from the Unix permissions side, but I don't think that's really what you want to do. Take a look at the Users and Security section of the Samba book. I think you're most interested in the "admin users" configuration option.
Posted by: SonicSnoop

Re: Hopefully the last linux question for you guuys... - 08/06/2005 08:11

Thank you using the admin user part for the samba share worked perfectly for me!