Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

chmod not descending into subdirs/following symlinks

From: <jan.niemann(at)tu-bs.de>
Date: Sat May 17 2003 - 22:19:46 EDT


hello,

chmod -R doesn't descend into directories it has access to. this is especially nasty when i want it to follow symlinks.

Example :

jan $ mkdir test
jan $ touch test/file target
jan $ ln -s ../target test/link
jan $ chmod -RL 777 test
jan $ ls -lR             

total 2
-rwxrwxrwx 1 jan jan 0 May 18 04:13 target* drwxrwxrwx 2 jan jan 512 May 18 04:13 test/

./test:
total 0
-rwxrwxrwx 1 jan jan 0 May 18 04:13 file* lrwxr-xr-x 1 jan jan 9 May 18 04:13 link@ -> ../target jan $ chmod -RL 444 test
chmod: test/file: Permission denied
chmod: test/link: Permission denied
jan $ sudo ls -lR
total 2
-rwxrwxrwx 1 jan jan 0 May 18 04:13 target dr--r--r-- 2 jan jan 512 May 18 04:13 test

./test:
total 0
-rwxrwxrwx 1 jan jan 0 May 18 04:13 file lrwxr-xr-x 1 jan jan 9 May 18 04:13 link -> ../target

my idea was to try to set permissions on directories to 0500 in pre-order traversal and set correct permissions in postorder.

i really hope that someone has a better idea for this...

Index: chmod.c



RCS file: /cvs/src/bin/chmod/chmod.c,v
retrieving revision 1.14
diff -r1.14 chmod.c
69,71c69,71
< gid_t a_gid(const char *);
< uid_t a_uid(const char *);
< void usage(void);
---

> static gid_t a_gid(const char *);
> static uid_t a_uid(const char *);
> static void usage(void);
81c81 < int Hflag, Lflag, Pflag, Rflag, ch, fflag, fts_options, hflag, rval; ---
> int Hflag, Lflag, Rflag, ch, fflag, fts_options, hflag, rval;
100c100 < Hflag = Lflag = Pflag = Rflag = fflag = hflag = 0; ---
> Hflag = Lflag = Rflag = fflag = hflag = 0;
105c105 < Lflag = Pflag = 0; ---
> Lflag = 0;
109c109 < Hflag = Pflag = 0; ---
> Hflag = 0;
112d111 < Pflag = 1; 227,230c226,234 < if (ischmod) < break; < else < continue; ---
> if (ischmod) {
> /*
> * a silent chmod allows access to all
> * subdirs, correct permissions are set during
> * post-order traversal
> */
> chmod(p->fts_path, S_IRUSR|S_IXUSR);
> }
> continue;
237,238d240 < continue; < else 285c287 < uid_t ---
> static uid_t
307c309 < gid_t ---
> static gid_t
329c331 < void ---
> static void
Received on Sat May 17 22:23:01 2003
Do you need help?X

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:29:57 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library