psql’s \copy (note the backslash) lets you copy to/from remote databases and does not require superuser privileges.
psql \
-h $hostname -d $dbname -U $username \
-c "\copy mytable (column1, column2) from '/path/to/local/file.csv' with delimiter as ','"
https://www.postgresql.org/docs/current/sql-copy.html