mkdir: cannot create directory `/builds/somedir/': Permission denied | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

mkdir: cannot create directory `/builds/somedir/': Permission denied

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-01-2011
Technext Technext is offline
Registered User
 
Join Date: May 2010
Last Activity: 5 June 2012, 7:09 AM EDT
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
mkdir: cannot create directory `/builds/somedir/': Permission denied

Hi,


I am trying to run a shell script which contains an mkdir command as part of the execution. The script fails with the following error:

Code:
  mkdir: cannot create directory `/builds/somedir/': Permission denied

The user running the script is 'harry' and belongs to group 'school'. The target directory is owned by another user ‘sally’.

ls -ld /builds/somedir/

Code:
  drwxr-xr-x+   14  sally  bin  1024 May 31 18:01 /builds/somedir/

The above path (/builds/somedir/) is a Samba share.

To make it work, I tried few things but to no avail:
--------------------------------------------------
1.
Code:
setfacl -d -m u:harry:rwx /builds/somedir
     setfacl -d -m g:school:rwx /builds/somedir

2. Added following entry in /etc/sudoers file

Code:
# User privilege specification
  harry ALL=(ALL) ALL

--------------------------------------------------

After making these changes, I tried running the mkdir command manually also but no luck.

The OS is GNU\Linux.

There is one thing weird that I just noticed: even with root user, I was not able to create directory in the given path. Does it has anything to do with Samba share?

After noticing this behavior, I removed the above entry from sudoers file, and instead added the following but still no luck.
-----------------------

Code:
harry ALL=(sally) ALL

-----------------------

Any ideas\inputs?


Regards,
Gaurav

Last edited by pludi; 06-01-2011 at 04:55 AM..
Sponsored Links
    #2  
Old 06-01-2011
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 17 April 2014, 6:29 PM EDT
Location: Saskatchewan
Posts: 18,531
Thanks: 681
Thanked 3,036 Times in 2,856 Posts
Is the script running mkdir, or mkdir -p? without -p, mkdir will always fail when the directory already exists.

Depending on what groups harry belongs to, it may be possible to remedy the permissions without resort to ACLs.
Sponsored Links
    #3  
Old 06-01-2011
ctsgnb ctsgnb is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 1 April 2014, 12:03 PM EDT
Location: France
Posts: 2,927
Thanks: 80
Thanked 623 Times in 595 Posts
Are you on the same machine than the one running the Samba server ? or are you on a client machine that just "see" the "exported" Samba share ?

.. by the way ...[Chapter 6] Users, Security, and Domains
and Samba: Controlling Access to Shares
    #4  
Old 06-01-2011
Technext Technext is offline
Registered User
 
Join Date: May 2010
Last Activity: 5 June 2012, 7:09 AM EDT
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for your replies! To update, things are working now. I think i now know what blunder i was committing: i was running this script as follows:

Code:
sudo sh scriptname.sh

'su' must be assuming that my intended user is 'root', and since even root user was not able to create directory in the given path, the script was failing. When i changed it to the following, it worked:

Code:
sudo sally sh scriptname.sh

@Corona688: Nice catch! However, I am running 'mkdir -p'. By the way, even if i had not used -p option, i think i would have got a different error message, correct?

To answer your question, 'harry' belongs to another group called 'teacher'. I was wondering why 'setfacl' did not work though i could see it set using the 'getfacl' command. I was wondering about the other way that you mentioned to remedy this. Can you please hint me what you were referring to?

@ctsgnb: I am on a different machine than the Samba server. I just see the exported Samba share. Though i asked from my colleague whether the share is a Samba share or some other type of share, and he did say Samba, I was still wondering whether there is any concrete way to ascertain this. Thanks for the link ctsgnb!
Sponsored Links
    #5  
Old 06-01-2011
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 17 April 2014, 6:29 PM EDT
Location: Saskatchewan
Posts: 18,531
Thanks: 681
Thanked 3,036 Times in 2,856 Posts
Quote:
Originally Posted by Technext View Post
To answer your question, 'harry' belongs to another group called 'teacher'. I was wondering why 'setfacl' did not work though i could see it set using the 'getfacl' command. I was wondering about the other way that you mentioned to remedy this. Can you please hint me what you were referring to?
Change the group of the dir to 'teacher' and set it group-writable.
Sponsored Links
    #6  
Old 06-01-2011
Technext Technext is offline
Registered User
 
Join Date: May 2010
Last Activity: 5 June 2012, 7:09 AM EDT
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Corona688 View Post
Change the group of the dir to 'teacher' and set it group-writable.
Ok. Yes that was the first thing that came to my mind yesterday but i don't have to change the group that's why never went for it. Thanks!
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
[Solved] how to create multiple directory in one mkdir command ken002 Shell Programming and Scripting 3 05-11-2011 03:15 PM
mkdir: cannot create directory ./hari.sh UNIX and Linux Applications 12 12-09-2010 06:28 PM
Permission Denied toamarnath AIX 1 04-06-2009 11:10 PM
Permission denied message for parent directory Sreerag446 Solaris 3 02-19-2009 03:44 AM
rcp 'permission denied' Kevin Pryke UNIX for Dummies Questions & Answers 6 04-24-2002 04:20 AM



All times are GMT -4. The time now is 05:24 AM.