SSH chmod question

Our NAS vendor uses  *NIX as the OS for thier platform. I ran into an issue of not being able to delete some files from the NAS in our Windows environment through a CIFS share. Our vendor (Bluearc) gave me instructions for deleting from their back-end. I SSH to this back-end, connect to the shares and can change permissions and delete files using the normal commands. The problem i'm having is some directories have multiple directories under it and sometimes many more under that. So my problem is I have to manually cd to each directory to either change permissions (so I can access through the CIFS share) or delete everything in that directory. If it happens to contain another directory with 200 folders in it I have to go to each one of those folder and delete everything manually to be able to delete the parent folder. I did a quick google and it shows me the recursive switch to chmod but that doesn't work on my *NIX system.
So I though maybe a GUI would help and I tried EngInSite DataFreeway. Which does give me the SSH session in a pretty GUI but doesn't allow me to run the necessary commands to connect to the CIFS shares to change the permissions or delete files.
So does anyone know a work around, trick, tip, anything? I'm looking at probably over 1000 directories I would manually have to go and delete files. I've already done about 100 and my eyes started to cross. Any help is appreciated.
Who is Participating?
97WideGlideConnect With a Mentor Commented:
if chmod -r doesnt work how about
find . -exec chdir


Find . | xargs -ivf chmod 666 {}

Or something like that?
Sorry, im on iphone and fingers are fat.
pzozulkaConnect With a Mentor Commented:
Have you tried giving the parent directory full access?
chmod 777 directory

Followed by:
rm -rf directory
-r  Recursively remove directories and subdirectories in the argument list.
wwoops, meant to say
find . -exec chmod 666 {} \
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

digifuzzConnect With a Mentor Commented:
Try something like this:

chmod 777 -R ./dirname
rm -rf ./dirname

This recursively changes the permissions of <dirname> and all files and subdirectories, then forces a delete on anything and everything recursively through said folder.

Did you try the find command and did it work ?
macker-Connect With a Mentor Commented:
If -r, -R, and --recursive aren't working, I'd ask the vendor.

If the recursive mode isn't working, for some reason, then find is the next best answer.

find dir -exec chCommand {} \;


find subdir -exec chmod 777 {} \;

(the ; terminates the command, while the \ escapes it, so the shell doesn't think you're trying to chain commands)
js479Author Commented:
Thanks for the suggestions and I intend to try them as soon as I jump back on this project.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.