I managed to setup samba on a ubuntu server so that I can browse my home directory /home/max
via windows.
Now I would like to share the directory /usr/local/apache2/htdocs
- what do I have to do in order to share files between windows and the apache htdocs dir? The htdocs dir is owned by www-data
.
I am pretty new to unix access permission stuff, so I really dont have a clue where to start with this. Any (easy) explanation is appreciated. Thanks!
Traditional Unix access permissions are fairly simple.
For each file or directory you define it's owner and the group it belongs to. A file or directory only has one group but a user can belong to many groups.
The permissions are defined for each of
The main permissions of relevance here are
When you use ls -l, these permissions are listed in the order suggested above. For example
(Spaces added for clarity) This means
When you access files on the server using a web-browser, it is the web-server which accesses those files on your behalf. background server processes (AKA daemons) have a username and group membership associated with them. Normally, web-users are unauthenticated so the web-server, apache, uses it's own owner and group on your behalf. If the web-server process is using www-data as it's group then it would be able to read the above example.html and serve it to web browsers.
You can see what effective user and group the web-servers is using like this:
The main process has all-powerful root permissions but the processes that satisfy web-browser requests (three in this case) have user www-data and group www-data. So these processes can read the example.html file using group permissions
The same general principles apply to Samba. The Samba server processes (e.g. smbd) can operate with several security configurations, so the exact answer depends on your Samba config file.
If your samba configuration for the "htdocs" share says "guest account = pcguest" and user pcguest is a member of group www-data then it should be able to read example.html.