chmod -R 777 somedir while excluding a dir in somedir?

How do I go about chmodding 777 to /srv/www/htdocs (and contents) without applying it to /srv/www/htdocs/phpMyAdmin and /srv/www/htdocs/phpPgAdmin ?

My guess would be

chmod -R 777 /srv/www/htdocs --exclude /srv/www/htdocs/phpMyAdmin --exclude /srv/www/htdocs/phpPgAdmin

Am I right, or am I wrong… and If I’m wrong what is the correct command?

find /srv/www/htdocs ! -regex '.*phpMyAdmin.*' -a ! -regex '.*phpPgAdmin.*' -print0 | xargs -0 chown axeia

BTW, chmod 777 should never be used, it is practically always the wrong thing to do. If your intention is to allow ordinary users to write into those directories, make them owned by you, or by the group you belong to, which is why I changed the chmod in the above command.

What I want to do… is allow me to work under windows from that directory via samba.

As I got eclipse running on windows and some files I’m using as a project within eclipse are in that samba share… so do I set their owner to a samba group or something?

The owner should be set to the account that’s logging onto that share. If yourself, then your account.

No logging in involved, I’ve set the share to ‘guest-ok’… so I’ll have to find out which userid the samba guest account has?
[edit]:

Or should I make a new group to which I add both the samba guest if even possible, and myself from the laptop (laptop running linux) (it’s a NFS share as well… for when I’m working under Linux).
Sure is getting complicated :stuck_out_tongue:

In that case it’s whatever the guest account maps to. You could also create a Linux group to grant access, say a webdoc group, and then put all the accounts that need access in this group in /etc/group. The directories and files would then need group write permission, so a chown followed by a chmod g+w is needed on them.

Any good resources about user rights and how to sort them? cause it sounds like I got some reading up to do.

The one I usually recommend is the RUTE guide. Here’s the relevant chapter:

http://rute.2038bug.com/node17.html.gz

Sorry, for access via group permissions I should have written a chgrp followed by a chmod g+w is needed on them.

On Sun December 21 2008 06:36 pm, Axeia wrote:

>
> No logging in involved, I’ve set the share to ‘guest-ok’… so I’ll have
> to find out which userid the samba guest account has?
>
>
Axeia;

The default Samba guest account is user “nobody”; you can test this for
yourself with:


testparm -v /etc/samba/smb.conf | grep "guest account ="

However, just setting “guest ok = yes” does not guarantee all of the share’s
users will be the guest account. You might want to look at “man smb.conf”
for the usage of the following parameters, “force user”, “force group”,
ane “guest only”, and see if any of these are appropriate for you.

P. V.
“We’re all in this together, I’m pulling for you.” Red Green

Mmmh I got it half working now 0.o

Made a new group htdocs and added nobody + Bakhuis to it, then set the folder to the group htdocs.
Bakhuis can’t do anything, but ‘nobody’ can.

Think I’ll just mount the SMB share on my linux boxes as well instead of having a double administration for both SMB and NFS shares and having to sort both their permissions… mainly didn’t in the first place because SMB felt a lot slower than NFS.
But they seem equally fast on 11.1.

With NFS there is the added complication that since the filesystem is exported, the permissions are evaluated at the client end. So assuming that the uids and gids match between server and client (another detail), it is the /etc/group on the client side that determines who has group access. In enterprise setups, there are usually site-wide passwd and group exported via NIS or LDAP to keep the uid, gids and names common and the admins sane.

On the other hand SMB permissions are evaluated at the server side. So your plan is fine.

Well as expected… I managed to not succeed in that either, but I created a new thread as it’s straying from this subforums focus. (and Swerdna is probably reading the other one more/able to help me out)

New thread can be found at Mount SMB Share - Error 13 Permission denied. - openSUSE Forums

Yeah, swerdna is da man. Good luck with it.