We have a multiple user shared account in server, and every time I login in my own account in server through ssh and use sudo -u shared_account -i
to login that account.
Now I want to copy some files to the shared account, and my current solution is:
scp
commandIs there any way I can copy files directly from my local PC to the folder of shared account in the server?
OS of server is Linux, and my local PC is Mac.
You could send an archive stream via ssh
and sudo
.
tar czf - file1 file2 file3 | ssh remote_system sudo -u shared_account tar xvzf -
Your comment to this answer shows that you have to enter your password when running sudo
. Unfortunately this wasn't mentioned in the question.
If you can run programs that open a TCP port, e.g. netcat
(nc
) as the shared user you could combine this with tar
(or cpio
) to transfer files directly using the shared user's permissions and environment.