Spinal
MB Enthusiast
- Joined
- Sep 14, 2004
- Messages
- 4,806
- Location
- between Uxbridge and the Alps
- Car
- x254, G350, Duster, S320, Mach1, 900ss and a few more
This ones a weird one...
I'm writing a script to check some permissions... that said, the script needs to be written into a GUI-based tool... which is causing a problem or two...
In essence, the script needs to check file permissions, so assuming you're working in root:
\Users\root\
idea is to check all files/directories in the home folder are owned by root and only editable by root... easy:
ls -lar | grep -v "root root"
-> gives us any files not owned by root with group root, and similar commands for the permissions. The GUI tool allows for AND, OR and NOT operators.
Second part I'm having trouble with... need to check that the parent folders are only writable by root...
so, in the example above,
\Users\root
and
\Users\
need to only root writable...
again, not too complex if given a scripting language...
Problem is, I need to write this as a 1-line command... any ideas of of a command that returns all the parent directories?
i.e.
root@~ someCommand .
would return
\Users\root
\Users
\
(which I could then pipe into ls, and in turn into grep... normally, while loop would do the trick...)
M.
I'm writing a script to check some permissions... that said, the script needs to be written into a GUI-based tool... which is causing a problem or two...
In essence, the script needs to check file permissions, so assuming you're working in root:
\Users\root\
idea is to check all files/directories in the home folder are owned by root and only editable by root... easy:
ls -lar | grep -v "root root"
-> gives us any files not owned by root with group root, and similar commands for the permissions. The GUI tool allows for AND, OR and NOT operators.
Second part I'm having trouble with... need to check that the parent folders are only writable by root...
so, in the example above,
\Users\root
and
\Users\
need to only root writable...
again, not too complex if given a scripting language...
Problem is, I need to write this as a 1-line command... any ideas of of a command that returns all the parent directories?
i.e.
root@~ someCommand .
would return
\Users\root
\Users
\
(which I could then pipe into ls, and in turn into grep... normally, while loop would do the trick...)
M.
Last edited: