[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

SSH chmod question

Posted on 2008-11-14
7
Medium Priority
?
1,005 Views
Last Modified: 2012-05-05
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.
0
Comment
Question by:js479
7 Comments
 
LVL 8

Accepted Solution

by:
97WideGlide earned 800 total points
ID: 22963929
if chmod -r doesnt work how about
find . -exec chdir

Or

Find . | xargs -ivf chmod 666 {}

Or something like that?
Sorry, im on iphone and fingers are fat.
0
 
LVL 8

Assisted Solution

by:pzozulka
pzozulka earned 800 total points
ID: 22963938
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.
0
 
LVL 8

Expert Comment

by:97WideGlide
ID: 22964067
wwoops, meant to say
find . -exec chmod 666 {} \
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Assisted Solution

by:digifuzz
digifuzz earned 200 total points
ID: 22995960
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.
0
 
LVL 8

Expert Comment

by:97WideGlide
ID: 22997114
js479,

Did you try the find command and did it work ?
0
 
LVL 7

Assisted Solution

by:macker-
macker- earned 200 total points
ID: 23001175
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 {} \;

e.g.

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)
0
 
LVL 1

Author Comment

by:js479
ID: 23089336
Thanks for the suggestions and I intend to try them as soon as I jump back on this project.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month19 days, 5 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question