0

I am trying to chown a file, and I am getting a Not ownermessage

bash-3.00$ uname -a
SunOS host001 5.10 Generic_138888-03 sun4u sparc SUNW,SPARC-Enterprise
bash-3.00$ id
uid=60010(user1) gid=910(web)
bash-3.00$ ls -l file.ext
-rwxrwxrwx   1 user1  web        17449 Feb 14 10:53 file.ext
bash-3.00$ chown user2 file.ext
chown: file.ext: Not owner

How could I detect if this machine has restricted chown usage?

fglez
  • 326
  • 4
  • 18

2 Answers2

3

getconf _POSIX_CHOWN_RESTRICTED / checks the setting on the / directory, POSIX allows different paths to have different values, such as local filesystems vs. NFS, hence the requirement to include a path to the directory or file you want to know about.

alanc
  • 1,500
  • 9
  • 12
1

As root:

echo "rstchown/D" | adb -k /dev/ksyms

If this returns "rstchown: 1", then you cannot chown unless root. You can add:

set rstchown = 0

to /etc/system to change this behavior.

Cakemox
  • 24,141
  • 6
  • 41
  • 67
  • Isn't there any way to check without root permission? – fglez Feb 14 '11 at 10:53
  • It's probably set to 1 because that is the default and you can't seem to chown files as a regular user. – Cakemox Feb 14 '11 at 11:26
  • Note that the above is for Solaris 10 and earlier. Solaris 11 replaced the /etc/system global option with a `rstchown` mount option for each mount point. – alanc Jan 21 '22 at 00:23