Search code examples
shellrootsudo

SCP File command as non-root user on the server


I have some files to upload. Usually to edit anything while logged in the server I must precede the command with sudo. That is known.

How do I send a file then as "admin" instead of "root" when I have disabled root login.

scp path\to\file admin@myaddress.com:/var/www/sitename/public/path/

PERMISSION DENIED


Solution

  • In my opinion, either you should give permissions to the admin user or scp your file to /tmp/ and then sudo mv /tmp/yourfile /var/www/sitename/public/path/.