LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-07-2014, 03:39 AM   #1
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Rep: Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320
about the command /usr/bin/install


I have tried the following:
Code:
~$ install -m 666 -d /tmp/aaa/bbb/ccc
~$ ls -lda /tmp/aaa
drwxr-xr-x 3 user group 60 Aug  7 10:24 /tmp/aaa
~$ ls -lda /tmp/aaa/bbb
drwxr-xr-x 3 user group 60 Aug  7 10:24 /tmp/aaa/bbb
~$ ls -lda /tmp/aaa/bbb/ccc
drw-rw-rw- 2 user group 40 Aug  7 10:24 /tmp/aaa/bbb/ccc
we can see aaa and bbb were created using umask and only ccc was created using the flags given (-m 666).

Is there any way to set the given permissions of all the dirs - not only the last one, but all the parents (of course I can write a script to do that). Is there any way to introduce a new flag (something like -r as recursive, -f force to set)? Does it make any sense?
 
Old 08-07-2014, 12:09 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
When you give the destination directory as part of a /path/to/directory, the last directory in the path is the destination, not each directory in the path.

In order to have each directory in the path also receives the desired permissions, try this:

Code:
install -m 666 -d /tmp/aaa -d /tmp/aaa/bbb -d /tmp/aaa/bbb/ccc
 
Old 08-08-2014, 12:10 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Original Poster
Rep: Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320
yes, that's what I would like to simplify. Actually I have an environment variable, and use something like install -m 755 -d $DIR/even/more/subdirs several times. Would be nice to have a switch (or two?) instead of evaluating that arbitrary expression in a script.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Cannot find 'ssh-keygen' in '/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin' venu.navat Linux - Software 3 03-08-2012 04:00 AM
[SOLVED] bash: /usr/local/bin/xdsi: /usr/bin/wish: bad interpreter: No such file or directory Berwhale Linux - Newbie 2 09-15-2011 02:59 PM
echo $PATH = /home/g3rc4n/bin:/usr/local/bin:/usr/bin:/bin:/usr/games ? i_heart_pandas Linux - Software 7 09-18-2009 08:33 AM
Failed to chck remot comnd executin using shells /usr/bin/ssh and /usr/bin/rsh farnaw4u Linux - Software 2 04-06-2009 12:08 AM
path in services wrong for clamav updated frm 0.75 to 0.80 usr/bin vs usr/local/bin Emmanuel_uk Linux - Newbie 3 04-22-2005 01:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:56 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration