Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scp file to different user in the remote server from local

Tags:

linux

scp

su

generally, i login to a server xyz.com using my login credentials([email protected]), my home = /home/user/myuserid/

after login, i do "su - someuser" to access the files.

i would like to copy a file from local machine to a directory in someuser eg: /abc/someuser/temp

for this, i am using scp somefile.txt [email protected]:/abc/someuser/temp/

it is asking my password for myuserid and then says.. /abc/someuser/temp/ permission denied

what command shall i use to copy a file to su in remote host?

like image 286
sandeep vn Avatar asked Sep 29 '14 22:09

sandeep vn


1 Answers

You'll have to use someuser's credentials to do the scp

scp somefile.txt [email protected]:/abc/someuser/temp/ 

Alternatively you can give myuserid permission to someuser's home directory.

like image 192
amo Avatar answered Oct 12 '22 14:10

amo