Reputation: 143
This has stumped me for a bit now after working on it for a while. I need to change the permission settings of all files and directories so that group and others have no read, write, or execute access except for one specific directory. So far I have tried variations of `
chmod go-rwx | chmod go+rwx 'filename'
Any tips?`
Upvotes: 0
Views: 884
Reputation: 31
I don't believe there's a solution shorter than a 2 steps pipeline.
Otherwise, you might want to check umask. umask changes the default permissions on a file on creation (sadly only on file created by the same shell, but you can add this to the .bash_rc/.bash_profile, so that every shell you'll open will do this by default)
umask 077
will set the mask so that every new file will have permissions like 700. So you might want to just use this so that in the future you won't need to re-launch that pipeline.
EDIT if the problem was the pipeline itself, then I'd do
cd && chmod -R 700 && cd 'path/to/that/directory' && chmod -R 777
with the double '&' instead of the pipe just because there's not output to pipe, so an && might do the trick
Upvotes: 1