I have a user on my server that has /usr/bin/git-shell in /etc/passwd.
How do I upload files to the folder ~/www/ on the server, where I have owner rights?
If I try scp, I get this error:
$ scp index.html [email protected]:~/www/
fatal: unrecognized command 'scp -t ~/www/'
lost connection
scp with git-shell
It possible to allow usage of
scpwithgit-shellby creating the followingscpexecutable file ingit-shell-commandsin the remote user home directory:For example, it is done in the frugalware git-hooks repo.
The file can be also customized to allow usage of
scponly for certain conditions, for example, for specific public keys.Details
It works because a local
scpcall executes the remotescpssh command with-tor-fargument. The protocol is explained here https://stackoverflow.com/a/50644600/4023446When
git-shellis used it allows only commands in the directorygit-shell-commands. So, the above script is executed during remote scp sessions launching the actual/usr/bin/scpbinary.