LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-30-2011, 12:21 PM   #1
suddublr
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Rep: Reputation: Disabled
unable to create directory under /opt


Dear Members,

On linux, as non-root[oracle] user am not able to create directory under /opt. It says Permission denied. But I understand /opt should not be specific to root, since the application installed as non-root gets installed under /opt.

any idea as how to create directory under /opt ?

cheers
Sud
 
Old 11-30-2011, 12:26 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Hello,

Because opt is located in / itself, it is owned by root. So technically saying, yes, /opt IS specific to root. Now what you can do is create a directory as root within opt, then change the ownership and permission of that newly created directory, and voila, there you go.

Cheers,

Josh
 
Old 11-30-2011, 01:26 PM   #3
suddublr
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank you. The step suggested by you will work and will be sort of work around. I have observed that on other linux system I could see many directories under /opt which does not belong to root. Is it something to do with user account ?.
 
Old 11-30-2011, 01:37 PM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
More of the permissions and ownership; Look at the following:
Code:
/
/opt/
/home/
.
.
.
etc...
You see, / is at the very top level of your directory structure. Since opt is located within the top level, it is owned by root. Of course, you could change the ownership and permissions of /opt itself, and you can do what you need to do. This, however, is technically a security issue, since you are allowing X users FULL permission of opt.
 
Old 11-30-2011, 01:53 PM   #5
suddublr
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Ok. Thank you. But I guess there wont be serious security breach if permission is given to /opt since system specific files are not present under /opt.
 
Old 11-30-2011, 01:58 PM   #6
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
True, but it's the thought. I would never do that, regardless if files were to be compromised or not.
 
Old 12-02-2011, 09:50 AM   #7
brucegraham
LQ Newbie
 
Registered: Jul 2011
Posts: 4

Rep: Reputation: Disabled
You could also set the sticky bit, e.g. 'chmod 1777 /opt', similar to how the '/tmp' directory is configured. That way anyone can create files and directories there but only the owner of files and directories under '/opt' can delete or rename them.
 
Old 12-02-2011, 10:11 AM   #8
traceman
LQ Newbie
 
Registered: Nov 2011
Posts: 1

Rep: Reputation: Disabled
Re: Unable to create directory under /opt

I’ve had to do something similar with various applications. If you want to create a usable directory in /opt
that user oracle can access and still maintain the permission/security integrity of /opt, do the following:

oracle$ su – # become root

# cd /opt
# mkdir oradir # hypothetical directory name
# chown –R oracleracle oradir # make user oracle the owner
# ls –la
-rwx-r—r-- oracle oracle oradir

# exit # get out of root

oracle$ cd /home/oracle # cd to whatever directory to create a link (optional) but suggested
oracle$ ln –s /opt/oradir oradir # create a link as the user needing access to the directory



It’s worked for me pretty well. The good thing is that you don’t have to compromise the permissions for the entire /opt
directory, just the directory within /opt that you need to access.

Last edited by traceman; 12-02-2011 at 10:19 AM.
 
  


Reply


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
Unable to create home directory using pam_mkhomedir.so sheelavantar Linux - Server 15 10-12-2011 12:47 AM
Unable to create home directory in Open Suse 11.3 abhinav4 SUSE / openSUSE 1 09-08-2010 01:57 AM
Unable to create a new user in Directory Server naman.jandial Linux - Server 4 07-16-2010 05:30 PM
Unable to create directory sunhui Linux - Software 1 04-02-2007 11:09 PM
Unable to create directory as user technician Slackware 4 02-15-2004 01:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:06 PM.

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