Operating System - HP-UX
1825782 Members
2141 Online
109687 Solutions
New Discussion

can anyone except root and owner change a file's read,write,x privilege?

 
SOLVED
Go to solution
常有慈悲心
Regular Advisor

can anyone except root and owner change a file's read,write,x privilege?

i want to know :
if a user can give someone else(except root) privilege to manage the file's privilege, like change file's read,write ,x privilege.

i use the command setprivgrp users CHOWN
but it does't work.


please help.
7 REPLIES 7
Pete Randall
Outstanding Contributor

Re: can anyone except root and owner change a file's read,write,x privilege?

If the other person belongs to the same group, then yes, they should be able to modify permissions. Otherwise you would have to use a setuid script or some package like sudo to temporarily grant root like privileges.


Pete

Pete
Sajith V Mannadiar
Frequent Advisor

Re: can anyone except root and owner change a file's read,write,x privilege?

I think you can then change the owner of the file to 'that user' who would like to change the file privileges
Geoff Wild
Honored Contributor

Re: can anyone except root and owner change a file's read,write,x privilege?

Depends on current permissions.

Example:

ll /etc/hosts
-r--r--r-- 1 bin bin 567 Jun 3 2004 /etc/hosts

Only root can change that.

ll /home/gwild/.profile
-rw-r--r-- 1 gwild adm 140 Oct 6 12:09 /home/gwild/.profile

Only root and gwild can change that.


ll /usr/local/ge/sha1.clog
-rw-rw---- 1 root adm 10565 Oct 1 10:02 /usr/local/ge/sha1.clog

Only root and those in the adm group can change that.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Patrick Wallek
Honored Contributor

Re: can anyone except root and owner change a file's read,write,x privilege?

Only root and the owner can chmod a file. All the group does is control read/write/exec privileges.

I just tried this from a user who was in the group of a file and got an error "Not owner"

Your only other option would be to utilize sudo in some fashion.
Patrick Wallek
Honored Contributor

Re: can anyone except root and owner change a file's read,write,x privilege?

Here's an example of what I just tried and the results:

$ ll firewall.12092004.Z
-rwxrwxr-- 1 root dns 12178263 Dec 9 08:00 firewall.12092004.Z
$ id
uid=108(user1) gid=20(users) groups=1000(dns),1001(firewall)
$ chmod 777 firewall.12092004.Z

RAC_1
Honored Contributor
Solution

Re: can anyone except root and owner change a file's read,write,x privilege?

Apart from what others have told, I think it should be possible to give perms to different group to chnage the ownership of files.
Set /etc/privgroup file. Check perms on it. Should be read to all.

The other option would be use of ACLs. For HFS files system, you would use lsacl and chacl commands. On VxFS file systems you can use getacl and setacl for this. The min. version of VxFS that supports ACL is version 4

Anil
There is no substitute to HARDWORK
Sanjay_6
Honored Contributor

Re: can anyone except root and owner change a file's read,write,x privilege?

Hi,

Only owner or root can change the perimissions of a file.

You can use sudo to grant permission for a user id to change permission for a file owned by another id. say the file is owned by abc and xyz wants to change the permissions of the file, you have to configure sudo to allow xyz to run chmond command as abc. While executing the command xyz will have to use "sudo -u abc chmod perm file_name"

If you don't have sudo, you can download sudo from here,

http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/sudo-1.6.8p1/

Check out the man pages too.

Hope this helps.

Regds