This discussion is archived
4 Replies Latest reply: Jan 24, 2013 10:31 AM by 986782 RSS

Got an error as "chown: file : Not owner" while executing 'chown' command

986782 Newbie
Currently Being Moderated
Hi There,

Could you please anyone help me out for query.

I got an error as "chown: file : Not owner" while executing the 'chown' command in .ksh script.

the below command i used in .ksh script

chown sr53717 /apps/aaa/bbb/ccc/ddd/welcome.gz

Note : owner of the /apps/aaa/bbb/ccc/ddd/ is sr53717
owner of the file(which is placed in /apps/aaa/bbb/ccc/ddd/ ) welcome.gz is sr54996

and whenever i tried to change the ownership of welcome.gz from sr54996 to sr53717 by using chown. I got the above error.

FYR, i have given the details of my machine below.

SunOS 5.8 Generic_117350-62 sun4u sparc SUNW,Sun-Fire-V440

please help me with your valuable answers.
  • 1. Re: Got an error as "chown: file : Not owner" while executing 'chown' command
    Nik Expert
    Currently Being Moderated
    Hi.

    By default only root can do chown.

    Read man chown

    .................

    The operating system has a configuration option
    {_POSIX_CHOWN_RESTRICTED}, to restrict ownership changes.
    When this option is in effect the owner of the file is
    prevented from changing the owner ID of the file. Only the
    super-user can arbitrarily change owner IDs whether or not
    this option is in effect. To set this configuration option,
    include the following line in /etc/system:

    set rstchown = 1

    To disable this option, include the following line in
    /etc/system:

    set rstchown = 0

    {_POSIX_CHOWN_RESTRICTED} is enabled by default. See sys-
    tem(4) and fpathconf(2).
    ..........................................
  • 2. Re: Got an error as "chown: file : Not owner" while executing 'chown' command
    986782 Newbie
    Currently Being Moderated
    Hi There,

    Thanks for your update. But in my machine, i could not the line 'set rstchown=1' in /etc/system

    please suggest any other possible way to fix this.

    FYR, the below is the snap of my /etc/system file of set lines.

    $ grep 'set' /etc/system

    * set:
    * To set variables in 'unix':
    * set nautopush=32
    * set maxusers=40
    * To set a variable named 'debug' in the module named 'test_module'
    * set test_module:debug = 0x13
    set shmsys:shminfo_shmmax=8589934592
    set shmsys:shminfo_shmseg=200
    set shmsys:shminfo_shmmni=2000
    set sd:sd_max_throttle=20
    set scsi_options=0x7F8
    set sd:sd_io_time=0x3C
    set lwp_default_stksize=0x6000
    set rpcmod:svc_default_stksize=0x6000
    set shmsys:share_page_table=0
    set semsys:seminfo_semmns=111
    set semsys:seminfo_semmsl=111
    set semsys:seminfo_semmni=20
    set msgsys:msginfo_msgmax=8192
    set msgsys:msginfo_msgmnb=16384
    set msgsys:msginfo_msgseg=8192
    set msgsys:msginfo_msgtql=1024
    #set shmsys:shminfo_shmmni=2000
    #set shmsys:shminfo_shmseg=200
    set emcp:bPxEnableInit=1
    set md:mirrored_root_flag=1
    set md_mirror:md_resync_bufsz = 2048
    set md:mddb_bootlist1="sd:135:16 sd:135:1050 sd:135:2084 sd:127:16"
    set md:mddb_bootlist2="sd:127:1050 sd:127:2084"
    set noexec_user_stack=1
    set noexec_user_stack_log=1

    Thanks in advance.
  • 3. Re: Got an error as "chown: file : Not owner" while executing 'chown' command
    Nik Expert
    Currently Being Moderated
    Hi.
    You should add this line to /etc/system:
    set rstchown = 0


    Mode set rstchown = 1 work by default, even not directly writen to /etc/system


    Ask system administrator (root) for make requirement changes.

    Or discuss with system administrator about RBAC, sudo, or other way delegate root permission.

    Regards.
  • 4. Re: Got an error as "chown: file : Not owner" while executing 'chown' command
    986782 Newbie
    Currently Being Moderated
    Hi nik,

    Many thanks for your valuable update.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points