how to create a user on a linux box where it - can be used for scp from the remote system - can't be used for ssh login from the remote system
Thanks in advance
how to create a user on a linux box where it - can be used for scp from the remote system - can't be used for ssh login from the remote system
Thanks in advance
You should use scponly. This is especially good if you only want to restrict certain users and maintain SSH with execution privileges for others.
wget 'https://sourceforge.net/projects/scponly/files/scponly/scponly-4.8/scponly-4.8.tgz'
scp is a bundled part of your SSH service i.e. scp is SSH. scponly is like an overlay, if you will, that provides a sort of pseudo-shell when certain users connect to it that will only allow for file transfers etc. but other users will still be able to SSH as normal. In order to disable scp you either have to stop the SSH service or disable it in your sshd_config.
– I_GNU_it_all_along
Sep 14 '16 at 15:05
If you are ok to use sftp instead of scp , then Match Group in sshd_config can do the task for you .
The following options need to be enabled in /etc/ssh/sshd_config
Subsystem sftp internal-sftp
Match Group sftpusers
ChrootDirectory /home/%u
ForceCommand internal-sftp -u 002
You can also setup chroot for that user. The ChrootDirectory must contain the necessary files and directories to support the user’s session.