LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   How to change the ownership of a directory ? (https://www.linuxquestions.org/questions/solaris-opensolaris-20/how-to-change-the-ownership-of-a-directory-4175620320/)

rpittala 12-26-2017 05:22 AM

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.

ondoho 12-26-2017 05:41 AM

Quote:

Originally Posted by rpittala (Post 5797881)
But, this did not work on Unix Solaris.

show us.

rpittala 12-26-2017 05:47 AM

Permission denied
 
Quote:

chown: /home/rpittala/R_gen/R_code_gen: Permission denied
This is when I run it from the admin account.

ondoho 12-26-2017 09:12 AM

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?

fatmac 12-26-2017 09:14 AM

https://docs.oracle.com/cd/E19683-01...s2s/index.html

TB0ne 12-26-2017 09:41 AM

Quote:

Originally Posted by rpittala (Post 5797891)
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.

BW-userx 12-26-2017 10:12 AM

Solaris, try logging in su in your terminal anyways, then run the commands.

jlliagre 12-26-2017 09:25 PM

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?

rpittala 12-27-2017 12:23 AM

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.

TB0ne 12-27-2017 08:54 AM

Quote:

Originally Posted by rpittala (Post 5798245)
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.

jlliagre 12-27-2017 11:05 AM

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


All times are GMT -5. The time now is 11:25 PM.