System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Ownership changing from sftp session

bachi
Occasional Advisor

Ownership changing from sftp session

Hi,

I am using sftp to transfer files in hp-ux server(11.23). I am able to change file permisson with out any issues. but when I am trying to change ownership with "chown" I am getting the below error.

Error:
sftp> chown kandurir:users PIDB_Scripts.txt
You must supply a numeric argument to the chown command.
sftp>

can you please help me some one to resolve this issue. i want change onwership from sftp session only for remote files.

Thanks,
Balaji.


4 REPLIES
Ganesan R
Honored Contributor

Re: Ownership changing from sftp session

Hi,

I think you may need to give userid:groupid instead of names.
Best wishes,

Ganesh.
Steven E. Protter
Exalted Contributor

Re: Ownership changing from sftp session

Shalom,

Suggest scp -p for file transfer to preserve permissions. Or using an actual shell script on the target to handle perms.

Password free access might help.

http://www.hpux.ws/?p=10

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ganesan R
Honored Contributor

Re: Ownership changing from sftp session

Hi,

You need to change ownership with chown command and group ownership with chgrp command

#chown userid
#chgrp grpid

Also you should have the permission to change ownerships..

Hope this helps.
Best wishes,

Ganesh.
Steven Schweda
Honored Contributor

Re: Ownership changing from sftp session

In case it's not obvious, UNIX (like every
other OS?) stores file ownership and group
as numbers. It also has ways of relating
these numbers to names (/etc/passwd,
/etc/group, NIS, ...).

There's no good reason to expect the
name-to-number mapping on a remote system to
agree with that on the local system, so,
apparently, "sftp> chown" is trying to save
you from making what could be a big mistake.