LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 12-26-2017, 05:22 AM   #1
rpittala
Member
 
Registered: Jan 2012
Location: PUNE
Distribution: SunOS sun4v sparc sun4v Solaris
Posts: 91
Blog Entries: 1

Rep: Reputation: Disabled
Question How to change the ownership of a directory ?


I have been dealing with ACLs and stuck with this problem. I have a directory which is copied from user machine to the Uinx server. So, the user is the owner of the directory. Now, in order to compile the files, I have to change the ownership of this directory to the admin account and also inherit the permissions to the subdirectories.

Tried with
Code:
chown -R user:group ../path
. But, this did not work on Unix Solaris.
 
Old 12-26-2017, 05:41 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 11,308
Blog Entries: 8

Rep: Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913
Quote:
Originally Posted by rpittala View Post
But, this did not work on Unix Solaris.
show us.
 
Old 12-26-2017, 05:47 AM   #3
rpittala
Member
 
Registered: Jan 2012
Location: PUNE
Distribution: SunOS sun4v sparc sun4v Solaris
Posts: 91

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Permission denied

Quote:
chown: /home/rpittala/R_gen/R_code_gen: Permission denied
This is when I run it from the admin account.
 
Old 12-26-2017, 09:12 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 11,308
Blog Entries: 8

Rep: Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913Reputation: 2913
admin as in root?
there are a few things that can prevent even root from modifying a file.
on linux, that is. i know nothing of solaris.
e.g. it could have the immutable attribute set, can be changed with 'chattr -i' iirc.
also, what are the actual ownership & permission of the file right now, and is "the admin" uid=0?

Last edited by ondoho; 12-26-2017 at 09:14 AM.
 
Old 12-26-2017, 09:14 AM   #5
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 2,877

Rep: Reputation: Disabled
https://docs.oracle.com/cd/E19683-01...s2s/index.html
 
Old 12-26-2017, 09:41 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 21,261

Rep: Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505
Quote:
Originally Posted by rpittala View Post
This is when I run it from the admin account.
Does none of what you've already been told about ACL's and permissions apply here? You've opened several threads in the past about permissions/ACL's, so it's surprising you're opening another, given the good amount of information you've already been given. You said you've been an administrator for years now, and are working on a doctorate...as such, you should know what kind of information you need to post, and have a REALLY good idea on what you should haven done/tried by now.
 
Old 12-26-2017, 10:12 AM   #7
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Slackware 14.2 current / Linux Mint / Debian / Void Linux
Posts: 8,315

Rep: Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741
Solaris, try logging in su in your terminal anyways, then run the commands.
 
Old 12-26-2017, 09:25 PM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Tribblix, Ubuntu/WSL
Posts: 9,761

Rep: Reputation: 459Reputation: 459Reputation: 459Reputation: 459Reputation: 459
Quote:
I have been dealing with ACLs and stuck with this problem.
Are ACLs involved here?
Did you set ACLs?
Do you see ACLs?
Quote:
I have a directory which is copied from user machine to the Uinx server.
What is the source machine OS and file system ?
What is the target machine Solaris version and file system ?
How was the directory copied?

Quote:
So, the user is the owner of the directory.
Did you check who own the directory and the files inside it?

Quote:
Now, in order to compile the files, I have to change the ownership of this directory to the admin account and also inherit the permissions to the subdirectories.
What is that "admin" account?
Under what account do you run the failing "chmod" command?
 
Old 12-27-2017, 12:23 AM   #9
rpittala
Member
 
Registered: Jan 2012
Location: PUNE
Distribution: SunOS sun4v sparc sun4v Solaris
Posts: 91

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
My apologies for not providing the detailed information thought that the provided information was sufficient. Please find the details below:
Quote:
Are ACLs involved here?
Did you set ACLs?
Do you see ACLs?
Yes, ACLs applied here.
ACLs supposed to be inherited from the top-level directory to the newly copied directory.(This could be an issue).
Yes, I see the ACLs.

Code:
drwx---rwx+  2 rp033  EEGX_CEG    1024 Dec 27 01:16 R_code_gen/
            owner@:rwxpdDaARWcCo-:fd----:allow
            owner@:rwxp-D-A--c---:fd----:allow
        user:ax000:rwxp-D-A--c---:fd----:allow
Quote:
Did you check who own the directory and the files inside it?
Yes, the directory and the files are being owned by the user.

Quote:
Under what account do you run the failing "chmod" command?
If you look at the above ACLs user:ax000 is the admin. Usually, "ax000" is the owner of all the files and directories except this copied directory

and the directory is being copied from a Windows OS.

Last edited by rpittala; 12-27-2017 at 01:05 AM.
 
Old 12-27-2017, 08:54 AM   #10
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 21,261

Rep: Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505Reputation: 5505
Quote:
Originally Posted by rpittala View Post
My apologies for not providing the detailed information thought that the provided information was sufficient. Please find the details below:
You've been told in the past to provide such details, so not sure why you thought omitting them would be a good thing now.
Quote:
Yes, ACLs applied here. ACLs supposed to be inherited from the top-level directory to the newly copied directory.(This could be an issue).
Yes, I see the ACLs.
Code:
drwx---rwx+  2 rp033  EEGX_CEG    1024 Dec 27 01:16 R_code_gen/
            owner@:rwxpdDaARWcCo-:fd----:allow
            owner@:rwxp-D-A--c---:fd----:allow
        user:ax000:rwxp-D-A--c---:fd----:allow
Yes, the directory and the files are being owned by the user. If you look at the above ACLs user:ax000 is the admin. Usually, "ax000" is the owner of all the files and directories except this copied directory and the directory is being copied from a Windows OS.
(Bold added for emphasis)

And this is another good thing to put in a problem...using Windows adds things into the equation, and the "admin" account now actually makes sense. So have you tried copying the directory on the Solaris box itself, and not through Windows? Tried changing the ownership to something that works with the Windows system? You omit things again, such as the use of Samba (is it being use here?), or how Windows is attached to this Solaris system, or what your actual goals are.

What are you trying to do? Because it doesn't sound like you're having a problem with ACL's, but rather with Windows.
 
Old 12-27-2017, 11:05 AM   #11
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Tribblix, Ubuntu/WSL
Posts: 9,761

Rep: Reputation: 459Reputation: 459Reputation: 459Reputation: 459Reputation: 459
You still missed to answer to three of my questions:

- What is the source machine OS and file system ? (You just stated Windows.)
- What is the target machine Solaris version and file system ? (I'm assuming Solaris 11.x)
- How was the directory copied?

In any case, the behavior you complain of is expected.

By default and for security reasons, an unprivileged Solaris user cannot give away ownership of a file or a directory.

There are various ways to change this:
  • grant the required privilege (PRIV_FILE_CHOWN_SELF) to the admin account
  • run the command as root
  • tune the ZFS dataset to allow this behavior:
    Code:
        zfs set rstchown=off pool/filesystem

Last edited by jlliagre; 12-27-2017 at 11:06 AM.
 
2 members found this post helpful.
  


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 change ownership of NFSv4 shared directory in redhat linux 6.3 sree.m Linux - Server 8 03-06-2013 11:26 PM
Directory ownership or permissions inside another directory Slyfox696 Linux - Newbie 3 11-02-2012 02:14 PM
Automatically change permissions/ownership of files in a directory Shimdidly Linux - Newbie 3 04-08-2012 08:22 PM
Change ownership of an entire directory. Shay Linux - Newbie 3 07-02-2010 09:03 PM
Creating script to change ownership directory on RHEL4U3 at startup Ferianto Linux - Enterprise 9 02-13-2008 10:01 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 10:05 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration