Permissions in /usr/bin

So, I logon normally via SSH key, now I want to scp a file into /usr/bin and don’t have permissions. afaik I only got user osmc. I’m surely missing something here.
I can mount via sftp but I can’t copy a file cause of permission issues. … Any idea?

Well there is a reason you don’t have permission, because normal users should not put files there.
If you want to put it there for a reason copy it to the home directory via scp and then use via ssh sudo mv to move the file

1 Like

I was wondering if I rather should move it to /usr/local/bin

That’s a more sensible location. You’ll still need sudo to copy it over.

sudo scp <file> osmc@<IP>:/usr/local/bin/ does it iirc.

Unfortunately, it looked promising but still created the file as user osmc. (And also messes up the SSH key-based access.)

[user@disp2327 Downloads]$ sudo scp README.md osmc@192.168.8.33:/tmp/
osmc@192.168.8.33's password: 
README.md                                                                                                                              100% 5349   393.6KB/s   00:00    
[user@disp2327 Downloads]$ scp README.md osmc@192.168.8.33:/tmp/README.md2
README.md

osmc@osmc:~$ ls -l /tmp
total 16
-rw-r--r-- 1 osmc osmc 5349 Jul 11 19:22 README.md
-rw-r--r-- 1 osmc osmc 5349 Jul 11 19:25 README.md2

scp isn’t going to change ownership, is it? If README.md was owned by osmc when it started out it will remain so. The OP wanted to copy a file into a directory owned by root which sudo scp does.

Elevates scp on your local system not the remote system

my bad. Remembered wrong.

That’s a better location for binaries installed by the user outside the files managed by the distribution. As was already mentioned the file ownership won’t change on its own:
sudo chown -v root:root /usr/local/bin/my_file
Better you trust who ever compiled this file before you run it on your system.