LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Suse/Novell
User Name
Password
Suse/Novell This Forum is for the discussion of Suse Linux.

Notices

Reply
 
Search this Thread
Old 03-26-2008, 08:55 AM   #1
vm_devadas
Member
 
Registered: Sep 2006
Location: India
Distribution: Redhat and Suse
Posts: 75

Rep: Reputation: 15
chmod and symbolic links


chmod -R in Solaris will change permissions on subdirs and when encountering a symbolic link, will change the permission on the pointed to file whether it be a file or just a directory and stop. c

hmod -R in SuSE seems to follow symbolic links through the whole directory structure.

Is this a bug in chmod?
 
Old 03-26-2008, 09:03 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,061

Rep: Reputation: 769Reputation: 769Reputation: 769Reputation: 769Reputation: 769Reputation: 769Reputation: 769
No, -R option "change files and directories recursively" (from the Linux manual page). The Solaris manual page "Recursively descend through directory arguments, setting the mode for each file as described above. When symbolic links are encountered, the mode of the target file is changed, but no recursion takes place."

Keep in mind that Solaris is, pretty much, System V and Linux is, pretty much, GNU (which stands for Gnu's not Unix). GNU utilities don't always work the same way Solaris' do.
 
Old 03-27-2008, 05:58 AM   #3
vm_devadas
Member
 
Registered: Sep 2006
Location: India
Distribution: Redhat and Suse
Posts: 75

Original Poster
Rep: Reputation: 15
Don't care what happens to the symlink permissions. I know that the permissions should change to the pointed to file. But the permissions will continue to change for all files under the link and traverse any other symbolic links encountered.

If there is a Directory space called ABC and in this directory structure there is a symbolic link to /data/mydata for example, and when make chmod permissions for the project space ABC, it will follow the mydata link and change all the permissions on the mydata files

Is there any option to avoid this?
 
Old 03-27-2008, 06:27 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,369
Blog Entries: 54

Rep: Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869
Quote:
Originally Posted by vm_devadas View Post
Is there any option to avoid this?
Sure. Either don't recurse or use a find script to exclude some part of the tree.
 
Old 03-27-2008, 06:32 AM   #5
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,061

Rep: Reputation: 769Reputation: 769Reputation: 769Reputation: 769Reputation: 769Reputation: 769Reputation: 769
Well, that's what the -R option seems like it's supposed to do... I'm wondering of I'm reading it correctly that the --preserve-root (fail to operate recursively on `/') option may be what you want (given your example)?

Or, maybe using a combination of find with the -P option (never follow symbolic links), xargs and chmod? Something like
Code:
find -P <path> -type f -print | xargs chmod mode
It would take two passes, one with -type f for files and another with -type d for directories
 
  


Reply

Tags
chmod, links, symbolic


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Symbolic Links SBN Linux - Newbie 5 08-09-2007 05:48 AM
chmod on a symbolic link sharathkv25 Linux - General 2 05-01-2007 12:05 AM
Symbolic Links suavecu Linux - Software 1 01-11-2006 10:04 PM
Symbolic links? TongueTied Linux - Newbie 3 08-27-2003 06:00 AM
Symbolic links Valerie Linux - Newbie 12 03-31-2002 01:49 AM


All times are GMT -5. The time now is 01:40 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration