gudii9
asked on
change owner in unix
Hi,
I see some folders( say folder_A which contains folder_C and folder_B which contains folder_D which again contains folder_#)) has xyz as owner. I want to change owner to abc to those folders and sub folders. How can i do it. How do same thing on some files say File_A and file_B etc preoperty files.please advise
I see some folders( say folder_A which contains folder_C and folder_B which contains folder_D which again contains folder_#)) has xyz as owner. I want to change owner to abc to those folders and sub folders. How can i do it. How do same thing on some files say File_A and file_B etc preoperty files.please advise
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i tried your command now i see error as
/crm/home/XYZ3ABC/opt/comp any/bea_do mains/12/x yz3abc/cfg /123.cfg': Operation not permitted
/crm/home/XYZ3ABC/opt/comp
You need privilege to change ownership if you are not the original owner.
Either "su -" or "sudo su -" to root and try again.
Either "su -" or "sudo su -" to root and try again.
ASKER
hmm i logged in as root only not sure.
let me sudo again
what is chmod and how that is different from chown
let me sudo again
what is chmod and how that is different from chown
chmod changes the file type.
ASKER
chown -R crm /crm/home/XYZ3ABC/opt/comp any/bea_do mains/12/x yz3abc/cfg
says operation not permited though
says operation not permited though
Run "whoami". What does it say?
Is this a valid path:
ls -l /crm/home/XYZ3ABC/opt/comp any/bea_do mains/12/x yz3abc/cfg
Usually home directories are in /home (i.e., /home/crm not the other way around).
Is this a valid path:
ls -l /crm/home/XYZ3ABC/opt/comp
Usually home directories are in /home (i.e., /home/crm not the other way around).
ASKER
it says crm
that path is bit weird to me also
that path is bit weird to me also
ASKER
under home there are different users like XYZ3ABC
and under 12 all web logic server instances are there
and under 12 all web logic server instances are there
ASKER
i have to login as xyz3abc not crm to chown
when i give chown command like
chown -R crm /crm/home/XYZ3ABC/opt/comp any/bea_do mains/12/x yz3abc
it seems worked except few tmp files where it said cannot change owner etc
now when i go to /crm/home/XYZ3ABC/opt/comp any/bea_do mains/12
i see xyz3abc whose owner is crm which is good but under xyz3abc i still see some folders owned by xyz3abc one owned by crm though
when i give chown command like
chown -R crm /crm/home/XYZ3ABC/opt/comp
it seems worked except few tmp files where it said cannot change owner etc
now when i go to /crm/home/XYZ3ABC/opt/comp
i see xyz3abc whose owner is crm which is good but under xyz3abc i still see some folders owned by xyz3abc one owned by crm though
ls -l /crm/home/XYZ3ABC/opt/comp any/bea_do mains/12/x yz3abc/cfg
getenforce
getenforce
Like I said. "su -" or "sudo su -" to root.
ASKER
getenforce??
ASKER
crm itself is root here which is weird thing
No, the user "root".
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
"sudo su -" works just fine when sudo'ing to root. your way, my way, it all depends upon preference.
ASKER
$ sudo -i [sudo] password for xyz3abc:
xyz3abc is not in the sudoers file. This incident will be reported.
sudo -i asked me for password which i gave and it says above weird message. what it means?
xyz3abc is not in the sudoers file. This incident will be reported.
sudo -i asked me for password which i gave and it says above weird message. what it means?
That means your account is not allowed to run sudo.
ASKER
That means your account is not allowed to run sudo.who decide which account allowed to run sudo or not? how to add that privilege?
That privilege is determined by /etc/sudoers
Depending on which linux you use, you may just need to add the user to the group sudoers, admin, or wheel.
Depending on which linux you use, you may just need to add the user to the group sudoers, admin, or wheel.
ASKER
chown: missing operand after `cfg'
getting above error?
i basically sudo as crm and then went to
/crm/home/XYZ3ABC/opt/comp
now cfg is under this
please advise