[clue] When is it OK to write to a 555 dir?

Stephen Queen svqueen at gmail.com
Wed May 2 15:39:52 MDT 2012


It is dangerous to name a file test. There is a valid shell command named test.

Steve

On 5/2/12, Alex samide <absamide at yahoo.com> wrote:
> David, I think I ran into this somewhere and I believe it had something to
> do with the redirect you used to create test.
>
> I have had times where I couldn't create a file or do a touch on it to
> update it, but I was allowed to redirect information into a file.
>
> I can't remember the reasoning behind it, but for some reason that floated
> to the top of my memory.
>
> Alex
>
>
>
> ________________________________
>  From: David L. Willson <DLWillson at TheGeek.NU>
> To: CLUE's mailing list <clue at cluedenver.org>
> Sent: Wednesday, May 2, 2012 2:21 PM
> Subject: [clue] When is it OK to write to a 555 dir?
>
>
> Weirdness... a directory is clearly 555, but I can write files into it.
> Files which I subsequently cannot remove...
>
> It should work like this:
>
>
> $ mkdir test
> dlwillson at dwillson-nb-1:5/~/temp 14:17:17
> $ chmod 555 test
> dlwillson at dwillson-nb-1:5/~/temp 14:17:23
> $ cd test
> dlwillson at dwillson-nb-1:5/~/temp/test 14:17:25
> $ ll
> total 8
> dr-xr-xr-x 2 dlwillson dlwillson 4096 May  2 14:17 ./
> drwxrwxr-x 3 dlwillson dlwillson 4096 May  2 14:17 ../
> dlwillson at dwillson-nb-1:5/~/temp/test 14:17:28
> $ > bingo
> bash: bingo: Permission denied
> dlwillson at dwillson-nb-1:5/~/temp/test 14:17:35
> $
>
> But instead it works like this:
>
>
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA
> 14:07:12
> $ cd COG/
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA/COG
> 14:07:18
> $ ll -d .
> dr-xr-xr-x 2 root bluearc 2048 May  2 13:53 .
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA/COG
> 14:09:41
> $ > test
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA/COG
> 14:10:03
> $ ll
> total 210112
> ...
> -rwxrwxrwx 1 dlsa     bluearc         43000 May  2 13:51 jeff.txt
> -rw-r--r-- 1 sudavidw linux_users         0 May  2 14:10 test
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA/COG
> 14:10:04
> $ ls -al
> total 210176
> dr-xr-xr-x 2 root     bluearc          2048 May  2 14:10 .
> dr-xr-xr-x 4 root     bluearc          2048 May  2 13:05 ..
> ...
> -rwxrwxrwx 1 dlsa     bluearc         43000 May  2 13:51 jeff.txt
> -rw-r--r-- 1 sudavidw linux_users         0 May  2 14:10 test
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA/COG
> 14:10:15
> $ rm test
> rm: cannot remove `test': Permission denied
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA/COG
> 14:10:30
> $ ll -Z
> -rwxrwxrwx  root     bluearc
> AUTO_SFJDL505ID_JDLNIDDID_20111118F001ID2011_5000000.out.DAT
> -rwxrwxrwx  root     bluearc
> COG_raw_1k_test_data_from_F001.txt
> -rwxrwxrwx  dlsa     bluearc                                      jeff.txt
> -rw-r--r--  sudavidw linux_users                                  test
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA/COG
> 14:10:55
> $ getfacl .
> # file: .
> # owner: root
> # group: bluearc
> user::r-x
> group::r-x
> other::r-x
>
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA/COG
> 14:11:20
> $ cp test test2
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA/COG
> 14:11:45
> $ ll
> total 210112
> -rwxrwxrwx 1 dlsa     bluearc         43000 May  2 13:51 jeff.txt
> -rw-r--r-- 1 sudavidw linux_users         0 May  2 14:10 test
> -rw-r--r-- 1 sudavidw linux_users         0 May  2 14:11 test2
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA/COG
> 14:11:47
> $ rm test*
> rm: cannot remove `test': Permission denied
> rm: cannot remove `test2': Permission denied
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA
> 14:13:51
> $ rm jeff.txt
> rm: cannot remove `jeff.txt': Permission denied
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA
> 14:14:00
> $ sudo rm jeff.txt
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA
> 14:14:06
> $ cd COG/
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA/COG
> 14:14:15
> $ ll
> total 210112
> ...
> -rwxrwxrwx 1 dlsa     bluearc         43000 May  2 13:51 jeff.txt
> -rw-r--r-- 1 sudavidw linux_users         0 May  2 14:10 test
> -rw-r--r-- 1 sudavidw linux_users         0 May  2 14:11 test2
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA/COG
> 14:14:16
> $ sudo rm test* jeff.txt
> sudavidw at dcoscrip01:1//net/nas1/NA/Technology/EDT/Test_data_for_new_COA/COG
> 14:14:22
> $
>
> --
> David L. Willson
> Trainer, Engineer, Enthusiast
> RHCE Network+ A+ Linux+ LPIC-1 Ubuntu
> Mobile 720-333-LANS(5267)
>
> This is a good time for a r3volution.
>
>
> _______________________________________________
> clue mailing list: clue at cluedenver.org
> For information, account preferences, or to unsubscribe see:
> http://cluedenver.org/mailman/listinfo/clue


More information about the clue mailing list