SSH chmod question

Posted on 2008-11-14
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.
Question by:js479
    LVL 8

    Accepted Solution

    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.
    LVL 8

    Assisted Solution

    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.
    LVL 8

    Expert Comment

    wwoops, meant to say
    find . -exec chmod 666 {} \

    Assisted Solution

    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.
    LVL 8

    Expert Comment


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

    Assisted Solution

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

    Author Comment

    Thanks for the suggestions and I intend to try them as soon as I jump back on this project.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
    Secure Shell (SSH) is a network protocol for secure data communication, mainly used to administer remote Unix / Linux servers via command line. But it also allows the user to open a secure tunnel between a client and a server where he can send any k…
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
    Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now